Interface AuthenticationState
- All Superinterfaces:
 Request.AuthenticationState
- All Known Subinterfaces:
 AuthenticationState.Deferred, AuthenticationState.ResponseSent, AuthenticationState.Succeeded
- All Known Implementing Classes:
 AuthenticationState.ServeAs, LoginAuthenticator.LoggedOutAuthentication, LoginAuthenticator.UserAuthenticationSent, LoginAuthenticator.UserAuthenticationSucceeded, SessionAuthentication
The Authentication state of a request.
The Authentication state can be one of several sub-types that reflects where the request is in the many different authentication cycles. Authentication might not yet be checked or it might be checked and failed, checked and deferred or succeeded.
- 
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAuthentication is Deferred, either so that credentials can later be passed withlogin(String, String, Request, Response); or that existing credentials on the request may be validated withAuthenticationState.Deferred.authenticate(Request); or an authentication dialog can be advanced withAuthenticationState.Deferred.authenticate(Request, Response, Callback).static interfaceAuthentication Response sent state.static classTheSecurityHandlerwill use this to wrap theRequest.static interfaceA successful Authentication with User information. - 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AuthenticationStateAuthentication challenge sent.static final AuthenticationStateAuthentication failure sent.static final AuthenticationStateAuthentication success sent. - 
Method Summary
Static MethodsModifier and TypeMethodDescriptionauthenticate(Request request) Get successful authentication for a request.authenticate(Request request, Response response, Callback callback) Get successful authentication for a request.static AuthenticationState.Deferreddefer(LoginAuthenticator loginAuthenticator) static AuthenticationStategetAuthenticationState(Request request) Get the authentication state of a request.static AuthenticationStategetUndeferredAuthenticationState(Request request) Get the authentication state of a request resolving anyAuthenticationState.Deferredauthentication.static PrincipalgetUserPrincipal(Request request) Get theUserPrincipalof an authenticated request.Attempt to login a request using the passed credentials.static booleanstatic voidsetAuthenticationState(Request request, AuthenticationState authenticationState) Set the authentication state of a request.static AuthenticationStatewriteError(Request request, Response response, Callback callback, int code) Methods inherited from interface Request.AuthenticationState
getUserPrincipal 
- 
Field Details
- 
CHALLENGE
Authentication challenge sent.This convenience instance is for when an authentication challenge has been sent.
 - 
SEND_FAILURE
Authentication failure sent.This convenience instance is for when an authentication failure has been sent.
 - 
SEND_SUCCESS
Authentication success sent.This convenience instance is for when an authentication success has been sent.
 
 - 
 - 
Method Details
- 
getAuthenticationState
Get the authentication state of a request.- Parameters:
 request- The request to query.- Returns:
 - The authentication state of the request or null if none.
 
 - 
getUndeferredAuthenticationState
Get the authentication state of a request resolving anyAuthenticationState.Deferredauthentication.- Parameters:
 request- The request to query.- Returns:
 - The authentication state of the request or null if none or 
AuthenticationState.Deferredauthentication could not be resolved. 
 - 
setAuthenticationState
Set the authentication state of a request.- Parameters:
 request- The request to updateauthenticationState- the state to set on the request.
 - 
getUserPrincipal
Get theUserPrincipalof an authenticated request. If theAuthenticationStateisAuthenticationState.Deferred, then an attempt to validate is made and theAuthenticationStateof the request is updated.- Parameters:
 request- The request to query- Returns:
 - The 
UserPrincipalof anyAuthenticationState.Succeededauthentication state, potential after validating aAuthenticationState.Deferredstate. - See Also:
 
 - 
authenticate
Get successful authentication for a request. If theAuthenticationStateisAuthenticationState.Deferred, then an attempt to authenticate, but without sending a challenge.- Parameters:
 request- The request to query.- Returns:
 - A 
AuthenticationState.Succeededauthentiction or null - See Also:
 
 - 
authenticate
static AuthenticationState.Succeeded authenticate(Request request, Response response, Callback callback) Get successful authentication for a request. If theAuthenticationStateisAuthenticationState.Deferred, then an attempt to authenticate, possibly sending a challenge. If authentication is not successful, then aHttpStatus.FORBIDDEN_403response is sent.- Parameters:
 request- The request to query.response- The response to use for a challenge or errorcallback- The collback to complete if a challenge or error is sent.- Returns:
 - A 
AuthenticationState.Succeededauthentication or null. If null is returned, then the callback will be completed. - See Also:
 
 - 
login
static AuthenticationState.Succeeded login(String username, String password, Request request, Response response) Attempt to login a request using the passed credentials. The currentAuthenticationStatemust beAuthenticationState.Deferred.- Parameters:
 request- The request to query.- Returns:
 - A 
AuthenticationState.Succeededauthentiction or null - See Also:
 
 - 
logout
 - 
writeError
static AuthenticationState writeError(Request request, Response response, Callback callback, int code)  - 
defer
 
 -