48         if (certs == null || certs.length == 0) {
    49             logger.debug(
"[ValidateX509CertificateUsername:authenticate] x509 client certificate is not available for mutual SSL.");
    50             context.getEvent().error(Errors.USER_NOT_FOUND);
    51             Response challengeResponse = 
errorResponse(Response.Status.UNAUTHORIZED.getStatusCode(), 
"invalid_request", 
"X509 client certificate is missing.");
    52             context.failure(AuthenticationFlowError.INVALID_USER, challengeResponse);
    56         X509AuthenticatorConfigModel config = null;
    57         if (context.getAuthenticatorConfig() != null && context.getAuthenticatorConfig().getConfig() != null) {
    58             config = 
new X509AuthenticatorConfigModel(context.getAuthenticatorConfig());
    61             logger.warn(
"[ValidateX509CertificateUsername:authenticate] x509 Client Certificate Authentication configuration is not available.");
    62             context.getEvent().error(Errors.USER_NOT_FOUND);
    63             Response challengeResponse = 
errorResponse(Response.Status.UNAUTHORIZED.getStatusCode(), 
"invalid_request", 
"Configuration is missing.");
    64             context.failure(AuthenticationFlowError.INVALID_USER, challengeResponse);
    70             CertificateValidator validator = builder.build(certs);
    71             validator.checkRevocationStatus()
    73                     .validateExtendedKeyUsage();
    74         } 
catch(Exception e) {
    75             logger.error(e.getMessage(), e);
    77             Response challengeResponse = 
errorResponse(Response.Status.UNAUTHORIZED.getStatusCode(), 
"invalid_request", e.getMessage());
    78             context.failure(AuthenticationFlowError.INVALID_USER, challengeResponse);
    83         if (userIdentity == null) {
    84             context.getEvent().error(Errors.INVALID_USER_CREDENTIALS);
    85             logger.errorf(
"[ValidateX509CertificateUsername:authenticate] Unable to extract user identity from certificate.");
    87             String errorMessage = 
"Unable to extract user identity from specified certificate";
    88             Response challengeResponse = 
errorResponse(Response.Status.UNAUTHORIZED.getStatusCode(), 
"invalid_request", errorMessage);
    89             context.failure(AuthenticationFlowError.INVALID_USER, challengeResponse);
    94             context.getEvent().detail(Details.USERNAME, userIdentity.toString());
    95             context.getAuthenticationSession().setAuthNote(AbstractUsernameFormAuthenticator.ATTEMPTED_USERNAME, userIdentity.toString());
    98         catch(ModelDuplicateException e) {
   100             String errorMessage = String.format(
"X509 certificate authentication's failed. Reason: \"%s\"", e.getMessage());
   101             Response challengeResponse = 
errorResponse(Response.Status.UNAUTHORIZED.getStatusCode(), 
"invalid_request", errorMessage);
   102             context.failure(AuthenticationFlowError.INVALID_USER, challengeResponse);
   106             logger.error(e.getMessage(), e);
   107             String errorMessage = String.format(
"X509 certificate authentication's failed. Reason: \"%s\"", e.getMessage());
   108             Response challengeResponse = 
errorResponse(Response.Status.UNAUTHORIZED.getStatusCode(), 
"invalid_request", errorMessage);
   109             context.failure(AuthenticationFlowError.INVALID_USER, challengeResponse);
   113             context.getEvent().error(Errors.INVALID_USER_CREDENTIALS);
   114             Response challengeResponse = 
errorResponse(Response.Status.UNAUTHORIZED.getStatusCode(), 
"invalid_grant", 
"Invalid user credentials");
   115             context.failure(AuthenticationFlowError.INVALID_USER, challengeResponse);
   118         if (!user.isEnabled()) {
   119             context.getEvent().user(user);
   120             context.getEvent().error(Errors.USER_DISABLED);
   121             Response challengeResponse = 
errorResponse(Response.Status.BAD_REQUEST.getStatusCode(), 
"invalid_grant", 
"Account disabled");
   122             context.failure(AuthenticationFlowError.INVALID_USER, challengeResponse);
   125         if (context.getRealm().isBruteForceProtected()) {
   126             if (context.getProtector().isTemporarilyDisabled(context.getSession(), context.getRealm(), user)) {
   127                 context.getEvent().user(user);
   128                 context.getEvent().error(Errors.USER_TEMPORARILY_DISABLED);
   129                 Response challengeResponse = 
errorResponse(Response.Status.BAD_REQUEST.getStatusCode(), 
"invalid_grant", 
"Account temporarily disabled");
   130                 context.failure(AuthenticationFlowError.INVALID_USER, challengeResponse);
   134         context.setUser(user);
 UserIdentityExtractor getUserIdentityExtractor(X509AuthenticatorConfigModel config)
Definition: AbstractX509ClientCertificateAuthenticator.java:222
 
UserIdentityToModelMapper getUserIdentityToModelMapper(X509AuthenticatorConfigModel config)
Definition: AbstractX509ClientCertificateAuthenticator.java:226
 
X509Certificate [] getCertificateChain(AuthenticationFlowContext context)
Definition: AbstractX509ClientCertificateAuthenticator.java:196
 
CertificateValidator.CertificateValidatorBuilder certificateValidationParameters(X509AuthenticatorConfigModel config)
Definition: AbstractX509ClientCertificateAuthenticator.java:101
 
void modelDuplicateException(@Cause ModelDuplicateException mde)
 
abstract UserModel find(AuthenticationFlowContext context, Object userIdentity)
 
Response errorResponse(int status, String error, String errorDescription)
Definition: AbstractX509ClientCertificateDirectGrantAuthenticator.java:37
 
abstract Object extractUserIdentity(X509Certificate[] certs)
 
static ServicesLogger logger
Definition: ValidateX509CertificateUsername.java:42