public static boolean hasAnyELExpression(BasicAuthenticationMechanismDefinition in) { return AnnotationELPProcessor.hasAnyELExpression( in.realmName()); }
@BasicAuthenticationMechanismDefinition( realmName="Soteria Realm"
public static boolean hasAnyELExpression(BasicAuthenticationMechanismDefinition in) { return AnnotationELPProcessor.hasAnyELExpression( in.realmName()); }
public static BasicAuthenticationMechanismDefinition eval(BasicAuthenticationMechanismDefinition in) { if (!hasAnyELExpression(in)) { return in; } BasicAuthenticationMechanismDefinitionAnnotationLiteral out = new BasicAuthenticationMechanismDefinitionAnnotationLiteral( evalImmediate(in.realmName())); out.setHasDeferredExpressions(hasAnyELExpression(out)); return out; }
public static BasicAuthenticationMechanismDefinition eval(BasicAuthenticationMechanismDefinition in) { if (!hasAnyELExpression(in)) { return in; } BasicAuthenticationMechanismDefinitionAnnotationLiteral out = new BasicAuthenticationMechanismDefinitionAnnotationLiteral( evalImmediate(in.realmName())); out.setHasDeferredExpressions(hasAnyELExpression(out)); return out; }
@Override public AuthenticationStatus validateRequest(HttpServletRequest request, HttpServletResponse response, HttpMessageContext httpMsgContext) throws AuthenticationException { String[] credentials = getCredentials(request); if (!isEmpty(credentials)) { IdentityStoreHandler identityStoreHandler = CDI.current().select(IdentityStoreHandler.class).get(); CredentialValidationResult result = identityStoreHandler.validate( new UsernamePasswordCredential(credentials[0], new Password(credentials[1]))); if (result.getStatus() == VALID) { return httpMsgContext.notifyContainerAboutLogin( result.getCallerPrincipal(), result.getCallerGroups()); } } if (httpMsgContext.isProtected()) { response.setHeader("WWW-Authenticate", format("Basic realm=\"%s\"", basicAuthenticationMechanismDefinition.realmName())); return httpMsgContext.responseUnauthorized(); } return httpMsgContext.doNothing(); }
@Override public AuthenticationStatus validateRequest(HttpServletRequest request, HttpServletResponse response, HttpMessageContext httpMsgContext) throws AuthenticationException { String[] credentials = getCredentials(request); if (!isEmpty(credentials)) { IdentityStoreHandler identityStoreHandler = CDI.current().select(IdentityStoreHandler.class).get(); CredentialValidationResult result = identityStoreHandler.validate( new UsernamePasswordCredential(credentials[0], new Password(credentials[1]))); if (result.getStatus() == VALID) { return httpMsgContext.notifyContainerAboutLogin( result.getCallerPrincipal(), result.getCallerGroups()); } } if (httpMsgContext.isProtected()) { response.setHeader("WWW-Authenticate", format("Basic realm=\"%s\"", basicAuthenticationMechanismDefinition.realmName())); return httpMsgContext.responseUnauthorized(); } return httpMsgContext.doNothing(); }