Search in sources :

Example 1 with ClientIdAndSecretAuthenticator

use of org.keycloak.authentication.authenticators.client.ClientIdAndSecretAuthenticator in project keycloak by keycloak.

the class DummyClientAuthenticator method authenticateClient.

@Override
public void authenticateClient(ClientAuthenticationFlowContext context) {
    ClientIdAndSecretAuthenticator authenticator = new ClientIdAndSecretAuthenticator();
    authenticator.authenticateClient(context);
    if (context.getStatus().equals(FlowStatus.SUCCESS)) {
        return;
    }
    String clientId = context.getUriInfo().getQueryParameters().getFirst("client_id");
    if (clientId == null) {
        clientId = context.getSession().getAttribute("client_id", String.class);
    }
    ClientModel client = context.getRealm().getClientByClientId(clientId);
    if (client == null) {
        context.failure(AuthenticationFlowError.CLIENT_NOT_FOUND, null);
        return;
    }
    context.getEvent().client(client);
    context.setClient(client);
    context.success();
}
Also used : ClientModel(org.keycloak.models.ClientModel) ClientIdAndSecretAuthenticator(org.keycloak.authentication.authenticators.client.ClientIdAndSecretAuthenticator)

Aggregations

ClientIdAndSecretAuthenticator (org.keycloak.authentication.authenticators.client.ClientIdAndSecretAuthenticator)1 ClientModel (org.keycloak.models.ClientModel)1