Add event for ClientScope created (#30715)

closes #30795 

Signed-off-by: Pascal Knüppel <pascal.knueppel@governikus.de>
This commit is contained in:
Pascal Knüppel 2024-06-27 19:05:29 +02:00 committed by GitHub
parent 220f32aa85
commit c4ebd0cd0c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 1 deletions

View file

@ -1021,8 +1021,23 @@ public class JpaRealmProvider implements RealmProvider, ClientProvider, ClientSc
entity.setName(name); entity.setName(name);
entity.setRealmId(realm.getId()); entity.setRealmId(realm.getId());
em.persist(entity); em.persist(entity);
ClientScopeModel clientScope = new ClientScopeAdapter(realm, em, session, entity);
session.getKeycloakSessionFactory().publish(new ClientScopeModel.ClientScopeCreatedEvent() {
@Override
public KeycloakSession getKeycloakSession() {
return session;
}
@Override
public ClientScopeModel getClientScope() {
return clientScope;
}
});
em.flush(); em.flush();
return new ClientScopeAdapter(realm, em, session, entity); return clientScope;
} }
@Override @Override

View file

@ -34,6 +34,12 @@ public interface ClientScopeModel extends ProtocolMapperContainerModel, ScopeCon
KeycloakSession getKeycloakSession(); KeycloakSession getKeycloakSession();
} }
interface ClientScopeCreatedEvent extends ProviderEvent {
ClientScopeModel getClientScope();
KeycloakSession getKeycloakSession();
}
String getId(); String getId();
String getName(); String getName();