KEYCLOAK-3369: Fire RealmPostCreateEvent

This commit is contained in:
Dmitry Telegin 2016-07-30 01:59:55 +03:00 committed by Dimitri Teleguin
parent 26f0f6509a
commit fea277a7f5
2 changed files with 27 additions and 4 deletions

View file

@ -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();

View file

@ -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;
}
});
}
}