KEYCLOAK-3369: Fire RealmPostCreateEvent
This commit is contained in:
parent
26f0f6509a
commit
fea277a7f5
2 changed files with 27 additions and 4 deletions
|
@ -38,6 +38,11 @@ public interface RealmModel extends RoleContainerModel {
|
|||
RealmModel getCreatedRealm();
|
||||
}
|
||||
|
||||
interface RealmPostCreateEvent extends ProviderEvent {
|
||||
RealmModel getCreatedRealm();
|
||||
KeycloakSession getKeycloakSession();
|
||||
}
|
||||
|
||||
interface RealmRemovedEvent extends ProviderEvent {
|
||||
RealmModel getRealm();
|
||||
KeycloakSession getKeycloakSession();
|
||||
|
@ -342,19 +347,19 @@ public interface RealmModel extends RoleContainerModel {
|
|||
Set<String> getEventsListeners();
|
||||
|
||||
void setEventsListeners(Set<String> listeners);
|
||||
|
||||
|
||||
Set<String> getEnabledEventTypes();
|
||||
|
||||
void setEnabledEventTypes(Set<String> enabledEventTypes);
|
||||
|
||||
|
||||
boolean isAdminEventsEnabled();
|
||||
|
||||
void setAdminEventsEnabled(boolean enabled);
|
||||
|
||||
|
||||
boolean isAdminEventsDetailsEnabled();
|
||||
|
||||
void setAdminEventsDetailsEnabled(boolean enabled);
|
||||
|
||||
|
||||
ClientModel getMasterAdminClient();
|
||||
|
||||
void setMasterAdminClient(ClientModel client);
|
||||
|
|
|
@ -121,6 +121,8 @@ public class RealmManager implements RealmImporter {
|
|||
setupOfflineTokens(realm);
|
||||
setupAuthorizationServices(realm);
|
||||
|
||||
fireRealmPostCreate(realm);
|
||||
|
||||
return realm;
|
||||
}
|
||||
|
||||
|
@ -491,6 +493,7 @@ public class RealmManager implements RealmImporter {
|
|||
}
|
||||
|
||||
setupAuthorizationServices(realm);
|
||||
fireRealmPostCreate(realm);
|
||||
|
||||
return realm;
|
||||
}
|
||||
|
@ -587,4 +590,19 @@ public class RealmManager implements RealmImporter {
|
|||
private void setupAuthorizationServices(RealmModel realm) {
|
||||
KeycloakModelUtils.setupAuthorizationServices(realm);
|
||||
}
|
||||
|
||||
private void fireRealmPostCreate(RealmModel realm) {
|
||||
session.getKeycloakSessionFactory().publish(new RealmModel.RealmPostCreateEvent() {
|
||||
@Override
|
||||
public RealmModel getCreatedRealm() {
|
||||
return realm;
|
||||
}
|
||||
@Override
|
||||
public KeycloakSession getKeycloakSession() {
|
||||
return session;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue