Search in sources :

Example 1 with ClientCRUDContext

use of org.keycloak.services.clientpolicy.context.ClientCRUDContext in project keycloak by keycloak.

the class RejectResourceOwnerPasswordCredentialsGrantExecutor method executeOnEvent.

@Override
public void executeOnEvent(ClientPolicyContext context) throws ClientPolicyException {
    switch(context.getEvent()) {
        case REGISTER:
        case UPDATE:
            ClientCRUDContext clientUpdateContext = (ClientCRUDContext) context;
            autoConfigure(clientUpdateContext.getProposedClientRepresentation());
            validate(clientUpdateContext.getProposedClientRepresentation());
            break;
        case RESOURCE_OWNER_PASSWORD_CREDENTIALS_REQUEST:
            ResourceOwnerPasswordCredentialsContext ropcContext = (ResourceOwnerPasswordCredentialsContext) context;
            executeOnAuthorizationRequest(ropcContext.getParams());
            return;
        default:
            return;
    }
}
Also used : ClientCRUDContext(org.keycloak.services.clientpolicy.context.ClientCRUDContext) ResourceOwnerPasswordCredentialsContext(org.keycloak.services.clientpolicy.context.ResourceOwnerPasswordCredentialsContext)

Example 2 with ClientCRUDContext

use of org.keycloak.services.clientpolicy.context.ClientCRUDContext in project keycloak by keycloak.

the class SecureClientAuthenticatorExecutor method executeOnEvent.

@Override
public void executeOnEvent(ClientPolicyContext context) throws ClientPolicyException {
    switch(context.getEvent()) {
        case REGISTER:
        case UPDATE:
            ClientCRUDContext clientUpdateContext = (ClientCRUDContext) context;
            autoConfigure(clientUpdateContext.getProposedClientRepresentation());
            validateDuringClientCRUD(clientUpdateContext.getProposedClientRepresentation());
            break;
        case TOKEN_REQUEST:
        case SERVICE_ACCOUNT_TOKEN_REQUEST:
        case TOKEN_REFRESH:
        case TOKEN_REVOKE:
        case TOKEN_INTROSPECT:
        case LOGOUT_REQUEST:
            validateDuringClientRequest();
        default:
            return;
    }
}
Also used : ClientCRUDContext(org.keycloak.services.clientpolicy.context.ClientCRUDContext)

Example 3 with ClientCRUDContext

use of org.keycloak.services.clientpolicy.context.ClientCRUDContext in project keycloak by keycloak.

the class FullScopeDisabledExecutor method executeOnEvent.

@Override
public void executeOnEvent(ClientPolicyContext context) throws ClientPolicyException {
    switch(context.getEvent()) {
        case REGISTER:
        case UPDATE:
            ClientCRUDContext clientUpdateContext = (ClientCRUDContext) context;
            autoConfigure(clientUpdateContext.getProposedClientRepresentation());
            validate(clientUpdateContext.getProposedClientRepresentation());
            break;
        default:
            return;
    }
}
Also used : ClientCRUDContext(org.keycloak.services.clientpolicy.context.ClientCRUDContext)

Example 4 with ClientCRUDContext

use of org.keycloak.services.clientpolicy.context.ClientCRUDContext in project keycloak by keycloak.

the class ConsentRequiredExecutor method executeOnEvent.

@Override
public void executeOnEvent(ClientPolicyContext context) throws ClientPolicyException {
    ClientCRUDContext clientUpdateContext = null;
    switch(context.getEvent()) {
        case REGISTER:
            clientUpdateContext = (ClientCRUDContext) context;
            autoConfigure(clientUpdateContext.getProposedClientRepresentation());
            validate(clientUpdateContext.getProposedClientRepresentation());
            break;
        case UPDATE:
            clientUpdateContext = (ClientCRUDContext) context;
            autoConfigure(clientUpdateContext.getProposedClientRepresentation());
            beforeUpdate(clientUpdateContext.getTargetClient(), clientUpdateContext.getProposedClientRepresentation());
            break;
        default:
            return;
    }
}
Also used : ClientCRUDContext(org.keycloak.services.clientpolicy.context.ClientCRUDContext)

Example 5 with ClientCRUDContext

use of org.keycloak.services.clientpolicy.context.ClientCRUDContext in project keycloak by keycloak.

the class HolderOfKeyEnforcerExecutor method executeOnEvent.

@Override
public void executeOnEvent(ClientPolicyContext context) throws ClientPolicyException {
    HttpRequest request = session.getContext().getContextObject(HttpRequest.class);
    switch(context.getEvent()) {
        case REGISTER:
        case UPDATE:
            ClientCRUDContext clientUpdateContext = (ClientCRUDContext) context;
            autoConfigure(clientUpdateContext.getProposedClientRepresentation());
            validate(clientUpdateContext.getProposedClientRepresentation());
            break;
        case TOKEN_REQUEST:
        case SERVICE_ACCOUNT_TOKEN_REQUEST:
        case BACKCHANNEL_TOKEN_REQUEST:
            AccessToken.CertConf certConf = MtlsHoKTokenUtil.bindTokenWithClientCertificate(request, session);
            if (certConf == null) {
                throw new ClientPolicyException(OAuthErrorException.INVALID_REQUEST, "Client Certification missing for MTLS HoK Token Binding");
            }
            break;
        case TOKEN_REFRESH:
            checkTokenRefresh((TokenRefreshContext) context, request);
            break;
        case TOKEN_REVOKE:
            checkTokenRevoke((TokenRevokeContext) context, request);
            break;
        case USERINFO_REQUEST:
            checkUserInfo((UserInfoRequestContext) context, request);
            break;
        case LOGOUT_REQUEST:
            checkLogout((LogoutRequestContext) context, request);
            break;
        default:
            return;
    }
}
Also used : HttpRequest(org.jboss.resteasy.spi.HttpRequest) ClientCRUDContext(org.keycloak.services.clientpolicy.context.ClientCRUDContext) AccessToken(org.keycloak.representations.AccessToken) ClientPolicyException(org.keycloak.services.clientpolicy.ClientPolicyException)

Aggregations

ClientCRUDContext (org.keycloak.services.clientpolicy.context.ClientCRUDContext)9 HttpRequest (org.jboss.resteasy.spi.HttpRequest)2 ClientRepresentation (org.keycloak.representations.idm.ClientRepresentation)2 ClientPolicyException (org.keycloak.services.clientpolicy.ClientPolicyException)2 AuthorizationRequestContext (org.keycloak.services.clientpolicy.context.AuthorizationRequestContext)2 OIDCAdvancedConfigWrapper (org.keycloak.protocol.oidc.OIDCAdvancedConfigWrapper)1 AccessToken (org.keycloak.representations.AccessToken)1 AdminClientRegisterContext (org.keycloak.services.clientpolicy.context.AdminClientRegisterContext)1 AdminClientUpdateContext (org.keycloak.services.clientpolicy.context.AdminClientUpdateContext)1 DynamicClientRegisterContext (org.keycloak.services.clientpolicy.context.DynamicClientRegisterContext)1 DynamicClientUpdateContext (org.keycloak.services.clientpolicy.context.DynamicClientUpdateContext)1 ResourceOwnerPasswordCredentialsContext (org.keycloak.services.clientpolicy.context.ResourceOwnerPasswordCredentialsContext)1 TokenRequestContext (org.keycloak.services.clientpolicy.context.TokenRequestContext)1