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();
|
RealmModel getCreatedRealm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface RealmPostCreateEvent extends ProviderEvent {
|
||||||
|
RealmModel getCreatedRealm();
|
||||||
|
KeycloakSession getKeycloakSession();
|
||||||
|
}
|
||||||
|
|
||||||
interface RealmRemovedEvent extends ProviderEvent {
|
interface RealmRemovedEvent extends ProviderEvent {
|
||||||
RealmModel getRealm();
|
RealmModel getRealm();
|
||||||
KeycloakSession getKeycloakSession();
|
KeycloakSession getKeycloakSession();
|
||||||
|
@ -342,19 +347,19 @@ public interface RealmModel extends RoleContainerModel {
|
||||||
Set<String> getEventsListeners();
|
Set<String> getEventsListeners();
|
||||||
|
|
||||||
void setEventsListeners(Set<String> listeners);
|
void setEventsListeners(Set<String> listeners);
|
||||||
|
|
||||||
Set<String> getEnabledEventTypes();
|
Set<String> getEnabledEventTypes();
|
||||||
|
|
||||||
void setEnabledEventTypes(Set<String> enabledEventTypes);
|
void setEnabledEventTypes(Set<String> enabledEventTypes);
|
||||||
|
|
||||||
boolean isAdminEventsEnabled();
|
boolean isAdminEventsEnabled();
|
||||||
|
|
||||||
void setAdminEventsEnabled(boolean enabled);
|
void setAdminEventsEnabled(boolean enabled);
|
||||||
|
|
||||||
boolean isAdminEventsDetailsEnabled();
|
boolean isAdminEventsDetailsEnabled();
|
||||||
|
|
||||||
void setAdminEventsDetailsEnabled(boolean enabled);
|
void setAdminEventsDetailsEnabled(boolean enabled);
|
||||||
|
|
||||||
ClientModel getMasterAdminClient();
|
ClientModel getMasterAdminClient();
|
||||||
|
|
||||||
void setMasterAdminClient(ClientModel client);
|
void setMasterAdminClient(ClientModel client);
|
||||||
|
|
|
@ -121,6 +121,8 @@ public class RealmManager implements RealmImporter {
|
||||||
setupOfflineTokens(realm);
|
setupOfflineTokens(realm);
|
||||||
setupAuthorizationServices(realm);
|
setupAuthorizationServices(realm);
|
||||||
|
|
||||||
|
fireRealmPostCreate(realm);
|
||||||
|
|
||||||
return realm;
|
return realm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,6 +493,7 @@ public class RealmManager implements RealmImporter {
|
||||||
}
|
}
|
||||||
|
|
||||||
setupAuthorizationServices(realm);
|
setupAuthorizationServices(realm);
|
||||||
|
fireRealmPostCreate(realm);
|
||||||
|
|
||||||
return realm;
|
return realm;
|
||||||
}
|
}
|
||||||
|
@ -587,4 +590,19 @@ public class RealmManager implements RealmImporter {
|
||||||
private void setupAuthorizationServices(RealmModel realm) {
|
private void setupAuthorizationServices(RealmModel realm) {
|
||||||
KeycloakModelUtils.setupAuthorizationServices(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