Search in sources :

Example 11 with ClientManager

use of org.keycloak.services.managers.ClientManager 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();
    }
}
Also used : ClientModel(org.keycloak.models.ClientModel) ForbiddenException(org.keycloak.services.ForbiddenException) ClientManager(org.keycloak.services.managers.ClientManager) RealmManager(org.keycloak.services.managers.RealmManager)

Aggregations

ClientManager (org.keycloak.services.managers.ClientManager)11 RealmManager (org.keycloak.services.managers.RealmManager)11 ClientModel (org.keycloak.models.ClientModel)7 UserModel (org.keycloak.models.UserModel)6 RealmModel (org.keycloak.models.RealmModel)5 Test (org.junit.Test)4 AtomicReference (java.util.concurrent.atomic.AtomicReference)3 KeycloakSession (org.keycloak.models.KeycloakSession)3 UserSessionModel (org.keycloak.models.UserSessionModel)3 ClientPolicyException (org.keycloak.services.clientpolicy.ClientPolicyException)3 AbstractTestRealmKeycloakTest (org.keycloak.testsuite.AbstractTestRealmKeycloakTest)3 ModelTest (org.keycloak.testsuite.arquillian.annotation.ModelTest)3 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 ModelDuplicateException (org.keycloak.models.ModelDuplicateException)2 UserManager (org.keycloak.models.UserManager)2 ErrorResponseException (org.keycloak.services.ErrorResponseException)2 AuthenticationSessionModel (org.keycloak.sessions.AuthenticationSessionModel)2 RootAuthenticationSessionModel (org.keycloak.sessions.RootAuthenticationSessionModel)2