public interface HttpAuthenticator
It is the fundamental class for web/SSO authentication integration.
This interface contains many convenience methods for authentication integration with existing applications. For most applications, using the following methods will be sufficient to achieve SSO:authenticate:
authenticate a user.isAuthenticated:
determine if a request is authenticated.getPrincipal:
retrieve the principal for an authenticated request.logoff:
sign the user out.HttpAuthenticatorFactory
to get an
instance of a class, or use an IoC container (like Spring)
to manage the underlying implementation as a singleton.HttpAuthenticatorImpl
Modifier and Type | Method and Description |
---|---|
void |
authenticate(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String username,
String password)
Authenticate a remote user using SSO.
|
void |
authenticateWithoutValidatingPassword(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String username)
Authenticate a remote user using SSO, without validating their password.
|
SOAPPrincipal |
getPrincipal(javax.servlet.http.HttpServletRequest request)
Attempts to retrieve the principal from the request.
|
UserAuthenticationContext |
getPrincipalAuthenticationContext(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String username,
String password)
Generate a PrincipalAuthenticationContext object containing the
provided username and password, and validation factors from the
the request.
|
SecurityServerClient |
getSecurityServerClient()
Retrieve the underlying SecurityServerClient used
to communicate with the Crowd Security Server.
|
SoapClientProperties |
getSoapClientProperties()
Retrieve the underlying client properties used
to communicate with the Crowd Security Server.
|
String |
getToken(javax.servlet.http.HttpServletRequest request)
Retrieve the Crowd authentication token from the request either via:
a request attribute (not request parameter), OR
a cookie on the request
|
ValidationFactor[] |
getValidationFactors(javax.servlet.http.HttpServletRequest request)
Retrieves validation factors from the request:
Remote Address: the source IP address of the HTTP request.
Original Address: the X-Forwarded-For HTTP header (if present and distinct from the Remote Address).
|
boolean |
isAuthenticated(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Tests whether a request is authenticated via SSO.
|
void |
logoff(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Log off the SSO authenticated user.
|
void |
setPrincipalToken(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String token)
Sets the underlying principal token on:
the request: as an attribute, so the user is authenticated for the span of the request.
the response: as a cookie, so the user is authenticated for subsequent requests.
|
void |
verifyAuthentication(String username,
String password)
Authenticate a remote principal without using SSO.
|
String |
verifyAuthentication(String username,
String password,
ValidationFactor[] validationFactors)
Verifies the authentication of a principal's username/password,
given a set of validation factors.
|
SoapClientProperties getSoapClientProperties()
SecurityServerClient.getSoapClientProperties()
SecurityServerClient getSecurityServerClient()
void setPrincipalToken(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String token) throws InvalidAuthorizationTokenException, RemoteException, InvalidAuthenticationException
request
- HttpServletRequestresponse
- HttpServletResponsetoken
- token value to use.InvalidAuthorizationTokenException
- the application client's token is invalid.RemoteException
- there was an underlying error communicating with the server.InvalidAuthenticationException
- the username/password combination is invalid.SOAPPrincipal getPrincipal(javax.servlet.http.HttpServletRequest request) throws InvalidAuthorizationTokenException, RemoteException, InvalidTokenException, InvalidAuthenticationException
request
- servlet requestInvalidAuthorizationTokenException
- the application client's token is invalidRemoteException
- there are communication issues between the client and Crowd serverInvalidTokenException
- unable to find the tokenInvalidAuthenticationException
- he username/password combination is invalidString getToken(javax.servlet.http.HttpServletRequest request) throws InvalidTokenException
request
- HttpServletRequest.InvalidTokenException
- unable to find token in either a request attribute or cookie.setPrincipalToken(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, String)
boolean isAuthenticated(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws InvalidAuthorizationTokenException, RemoteException, ApplicationAccessDeniedException, InvalidAuthenticationException
request
- HttpServletRequestresponse
- HttpServletResponsetrue
if and only if the request has been authenticatedInvalidAuthorizationTokenException
- the application client's token is invalidRemoteException
- there was an underlying error communicating with the serverApplicationAccessDeniedException
- user does not have access to the applicationInvalidAuthenticationException
- the username/password combination is invalidvoid authenticate(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String username, String password) throws InvalidAuthorizationTokenException, RemoteException, InvalidAuthenticationException, InactiveAccountException, ApplicationAccessDeniedException, ExpiredCredentialException
See getValidationFactors(javax.servlet.http.HttpServletRequest)
for details regarding the validation factors used for authentication
request
- HttpServletRequest to obtain validation factorsresponse
- HttpServletResponse to write SSO cookieusername
- username of principalpassword
- password of principalInvalidAuthorizationTokenException
- the application client's token is invalidRemoteException
- there was an underlying error communicating with the serverInvalidAuthenticationException
- the username/password combination is invalidInactiveAccountException
- the principal's account has been deactivatedApplicationAccessDeniedException
- user does not have access to the applicationExpiredCredentialException
- the user's credentials have expired. The user must change their credentials in order to successfully authenticate.getValidationFactors(javax.servlet.http.HttpServletRequest)
void authenticateWithoutValidatingPassword(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String username) throws ApplicationAccessDeniedException, InvalidAuthenticationException, InvalidAuthorizationTokenException, InactiveAccountException, RemoteException
authenticate(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, String, String)
instead.request
- HttpServletRequest to obtain validation factorsresponse
- HttpServletResponse to write SSO cookieusername
- username of the principal that you have already authenticated via some external meansInvalidAuthorizationTokenException
- the application client's token is invalidRemoteException
- there was an underlying error communicating with the serverInvalidAuthenticationException
- the username/password combination is invalidInactiveAccountException
- the principal's account has been deactivatedApplicationAccessDeniedException
- user does not have access to the applicationString verifyAuthentication(String username, String password, ValidationFactor[] validationFactors) throws InvalidAuthorizationTokenException, InvalidAuthenticationException, RemoteException, InactiveAccountException, ApplicationAccessDeniedException, ExpiredCredentialException
authenticate
method instead.username
- username of principalpassword
- password of principalvalidationFactors
- validation factors used to generate a tokenInvalidAuthorizationTokenException
- the application client's token is invalid.RemoteException
- there was an underlying error communicating with the server.InvalidAuthenticationException
- the username/password combination is invalid.InactiveAccountException
- the principal's account has been deactivate.ApplicationAccessDeniedException
- user does not have access to the application.ExpiredCredentialException
- the user's credentials have expired. The user must change their credentials in order to successfully authenticate/void verifyAuthentication(String username, String password) throws InvalidAuthorizationTokenException, InvalidAuthenticationException, RemoteException, InactiveAccountException, ApplicationAccessDeniedException, ExpiredCredentialException
username
- username of the principal.password
- password of the principal.InvalidAuthorizationTokenException
- the application client's token is invalidInvalidAuthenticationException
- the username/password combination is invalidRemoteException
- there was an underlying error while connecting to the remote server.InactiveAccountException
- the user's account is invalid.ApplicationAccessDeniedException
- the user does not have access to the application.ExpiredCredentialException
- the user's credentials have expired. The user must change their credentials in order to successfully authenticate.SecurityServerClient.authenticatePrincipalSimple(String, String)
ValidationFactor[] getValidationFactors(javax.servlet.http.HttpServletRequest request)
request
- HttpServletRequest.void logoff(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws InvalidAuthorizationTokenException, RemoteException, InvalidAuthenticationException
request
- HttpServletRequest.response
- HttpServletResponse.InvalidAuthorizationTokenException
- the application client's token is invalidRemoteException
- there was an error while connecting to the remote server.InvalidAuthenticationException
- the username/password combination is invalid.UserAuthenticationContext getPrincipalAuthenticationContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String username, String password)
request
- HttpServletRequest.response
- unused.username
- username of principal.password
- password of principal.Copyright © 2020 Atlassian. All rights reserved.