/** * Creates a new instance of AuthenticationParameters, useful for a fluent/builder * style creation of parameters. * * @return a new AuthenticationParameters instance. */ public static AuthenticationParameters withParams() { return new AuthenticationParameters(); }
/** * Sets the credential to be used by the authentication mechanism responding * to the authenticate call in which these AuthenticationParameters are passed. * * @param credential the credential to be used by the authentication mechanism * * @return the instance of AuthenticationParameters on which this call was made, useful for a fluent/builder * style creation of parameters. */ public AuthenticationParameters credential(Credential credential) { setCredential(credential); return this; }
/** * Signal to the authentication mechanism responding to the authenticate call in which these * AuthenticationParameters are passed, that an explicit new authentication dialog is required, as opposed to * continuing a potentially existing one. * * @param newAuthentication whether a new authentication dialog is required to be started. * * @return the instance of AuthenticationParameters on which this call was made, useful for a fluent/builder * style creation of parameters. */ public AuthenticationParameters newAuthentication(boolean newAuthentication) { setNewAuthentication(newAuthentication); return this; }
/** * Signals that for this call to the authentication mechanism "remember me" should be applied, IFF the * "remember me" feature is configured for the authentication mechanism responding to the authenticate call. * * <p> * If "remember me" is not configured, this parameter is silently ignored. * * @see RememberMe * @see RememberMeIdentityStore * * @param rememberMe if <code>true</code> the "remember me" feature will be used if authentication succeeds and if so configured. * * @return the instance of AuthenticationParameters on which this call was made, useful for a fluent/builder * style creation of parameters. */ public AuthenticationParameters rememberMe(boolean rememberMe) { setRememberMe(rememberMe); return this; }
private static boolean hasCredential(HttpMessageContext httpMessageContext) { return httpMessageContext.getAuthParameters().getCredential() != null; }
private void tryClean(HttpMessageContext httpMessageContext) { // 1. Check if caller aborted earlier flow and does a new request to protected resource if (isOnProtectedURLWithStaleData(httpMessageContext)) { removeSavedRequest(httpMessageContext.getRequest()); removeCallerInitiatedAuthentication(httpMessageContext.getRequest()); } // 2. Check if caller aborted earlier flow and explicitly initiated a new authentication dialog if (httpMessageContext.getAuthParameters().isNewAuthentication()) { saveCallerInitiatedAuthentication(httpMessageContext.getRequest()); removeSavedRequest(httpMessageContext.getRequest()); removeSavedAuthentication(httpMessageContext.getRequest()); } }
/** * Signals that for this call to the authentication mechanism "remember me" should be applied, IFF the * "remember me" feature is configured for the authentication mechanism responding to the authenticate call. * * <p> * If "remember me" is not configured, this parameter is silently ignored. * * @see RememberMe * @see RememberMeIdentityStore * * @param rememberMe if <code>true</code> the "remember me" feature will be used if authentication succeeds and if so configured. * * @return the instance of AuthenticationParameters on which this call was made, useful for a fluent/builder * style creation of parameters. */ public AuthenticationParameters rememberMe(boolean rememberMe) { setRememberMe(rememberMe); return this; }
private static boolean hasCredential(HttpMessageContext httpMessageContext) { return httpMessageContext.getAuthParameters().getCredential() != null; }
private void tryClean(HttpMessageContext httpMessageContext) { // 1. Check if caller aborted earlier flow and does a new request to protected resource if (isOnProtectedURLWithStaleData(httpMessageContext)) { removeSavedRequest(httpMessageContext.getRequest()); removeCallerInitiatedAuthentication(httpMessageContext.getRequest()); } // 2. Check if caller aborted earlier flow and explicitly initiated a new authentication dialog if (httpMessageContext.getAuthParameters().isNewAuthentication()) { saveCallerInitiatedAuthentication(httpMessageContext.getRequest()); removeSavedRequest(httpMessageContext.getRequest()); removeSavedAuthentication(httpMessageContext.getRequest()); } }
/** * Creates a new instance of AuthenticationParameters, useful for a fluent/builder * style creation of parameters. * * @return a new AuthenticationParameters instance. */ public static AuthenticationParameters withParams() { return new AuthenticationParameters(); }
/** * Sets the credential to be used by the authentication mechanism responding * to the authenticate call in which these AuthenticationParameters are passed. * * @param credential the credential to be used by the authentication mechanism * * @return the instance of AuthenticationParameters on which this call was made, useful for a fluent/builder * style creation of parameters. */ public AuthenticationParameters credential(Credential credential) { setCredential(credential); return this; }
/** * Signal to the authentication mechanism responding to the authenticate call in which these * AuthenticationParameters are passed, that an explicit new authentication dialog is required, as opposed to * continuing a potentially existing one. * * @param newAuthentication whether a new authentication dialog is required to be started. * * @return the instance of AuthenticationParameters on which this call was made, useful for a fluent/builder * style creation of parameters. */ public AuthenticationParameters newAuthentication(boolean newAuthentication) { setNewAuthentication(newAuthentication); return this; }
/** * Signals that for this call to the authentication mechanism "remember me" should be applied, IFF the * "remember me" feature is configured for the authentication mechanism responding to the authenticate call. * * <p> * If "remember me" is not configured, this parameter is silently ignored. * * @see RememberMe * @see RememberMeIdentityStore * * @param rememberMe if <code>true</code> the "remember me" feature will be used if authentication succeeds and if so configured. * * @return the instance of AuthenticationParameters on which this call was made, useful for a fluent/builder * style creation of parameters. */ public AuthenticationParameters rememberMe(boolean rememberMe) { setRememberMe(rememberMe); return this; }
@Override public AuthenticationStatus validateRequest(HttpServletRequest request, HttpServletResponse response, HttpMessageContext httpMessageContext) throws AuthenticationException { if (hasCredential(httpMessageContext)) { IdentityStoreHandler identityStoreHandler = CDI.current().select(IdentityStoreHandler.class).get(); return httpMessageContext.notifyContainerAboutLogin( identityStoreHandler.validate( httpMessageContext.getAuthParameters() .getCredential())); } return httpMessageContext.doNothing(); }
/** * Creates a new instance of AuthenticationParameters, useful for a fluent/builder * style creation of parameters. * * @return a new AuthenticationParameters instance. */ public static AuthenticationParameters withParams() { return new AuthenticationParameters(); }
/** * Sets the credential to be used by the authentication mechanism responding * to the authenticate call in which these AuthenticationParameters are passed. * * @param credential the credential to be used by the authentication mechanism * * @return the instance of AuthenticationParameters on which this call was made, useful for a fluent/builder * style creation of parameters. */ public AuthenticationParameters credential(Credential credential) { setCredential(credential); return this; }
/** * Signal to the authentication mechanism responding to the authenticate call in which these * AuthenticationParameters are passed, that an explicit new authentication dialog is required, as opposed to * continuing a potentially existing one. * * @param newAuthentication whether a new authentication dialog is required to be started. * * @return the instance of AuthenticationParameters on which this call was made, useful for a fluent/builder * style creation of parameters. */ public AuthenticationParameters newAuthentication(boolean newAuthentication) { setNewAuthentication(newAuthentication); return this; }
/** * Signals that for this call to the authentication mechanism "remember me" should be applied, IFF the * "remember me" feature is configured for the authentication mechanism responding to the authenticate call. * * <p> * If "remember me" is not configured, this parameter is silently ignored. * * @see RememberMe * @see RememberMeIdentityStore * * @param rememberMe if <code>true</code> the "remember me" feature will be used if authentication succeeds and if so configured. * * @return the instance of AuthenticationParameters on which this call was made, useful for a fluent/builder * style creation of parameters. */ public AuthenticationParameters rememberMe(boolean rememberMe) { setRememberMe(rememberMe); return this; }
@Override public AuthenticationStatus validateRequest(HttpServletRequest request, HttpServletResponse response, HttpMessageContext httpMessageContext) throws AuthenticationException { if (hasCredential(httpMessageContext)) { IdentityStoreHandler identityStoreHandler = CDI.current().select(IdentityStoreHandler.class).get(); return httpMessageContext.notifyContainerAboutLogin( identityStoreHandler.validate( httpMessageContext.getAuthParameters() .getCredential())); } return httpMessageContext.doNothing(); }
/** * Creates a new instance of AuthenticationParameters, useful for a fluent/builder * style creation of parameters. * * @return a new AuthenticationParameters instance. */ public static AuthenticationParameters withParams() { return new AuthenticationParameters(); }