use of org.keycloak.services.managers.RealmManager in project keycloak by keycloak.
the class UserConsentWithUserStorageModelTest method after.
@After
public void after() {
testingClient.server().run(session -> {
RealmManager realmManager = new RealmManager(session);
RealmModel realm = realmManager.getRealmByName("original");
if (realm != null) {
session.sessions().removeUserSessions(realm);
UserModel user = session.users().getUserByUsername(realm, "user");
UserModel user1 = session.users().getUserByUsername(realm, "user1");
UserModel user2 = session.users().getUserByUsername(realm, "user2");
UserModel user3 = session.users().getUserByUsername(realm, "user3");
UserManager um = new UserManager(session);
if (user != null) {
um.removeUser(realm, user);
}
if (user1 != null) {
um.removeUser(realm, user1);
}
if (user2 != null) {
um.removeUser(realm, user2);
}
if (user3 != null) {
um.removeUser(realm, user3);
}
realmManager.removeRealm(realm);
}
});
}
use of org.keycloak.services.managers.RealmManager in project keycloak by keycloak.
the class AbstractClientRegistrationProvider method delete.
public void delete(String clientId) {
event.event(EventType.CLIENT_DELETE).client(clientId);
ClientModel client = session.getContext().getRealm().getClientByClientId(clientId);
auth.requireDelete(client);
if (new ClientManager(new RealmManager(session)).removeClient(session.getContext().getRealm(), client)) {
event.client(client.getClientId()).success();
} else {
throw new ForbiddenException();
}
}
Aggregations