com.atlassian.crowd.manager.authentication
@Transactional public class AliasingAwareTokenAuthenticationManager extends Object implements TokenAuthenticationManager
| Constructor and Description |
|---|
AliasingAwareTokenAuthenticationManager(TokenAuthenticationManager tokenAuthenticationManager,
ApplicationManager applicationManager,
AliasManager aliasManager) |
| Modifier and Type | Method and Description |
|---|---|
Token |
authenticateApplication(ApplicationAuthenticationContext authenticationContext,
TokenLifetime tokenLifetime)
Authenticates an application and generates an authentication token.
|
Token |
authenticateUser(UserAuthenticationContext authenticateContext) |
Token |
authenticateUser(UserAuthenticationContext authenticateContext,
TokenLifetime tokenLifetime)
Authenticates a user and and generates an authentication token.
|
Token |
authenticateUserWithoutValidatingPassword(UserAuthenticationContext authenticateContext)
Feigns the authentication process for a user and creates a token for the authentication without validating the password.
|
List<Application> |
findAuthorisedApplications(User user,
String applicationName)
Returns a list of applications a user
is authorised to authenticate with.
|
User |
findUserByToken(String key,
String applicationName)
Will find a user via the passed in token key.
|
Token |
findUserTokenByKey(String tokenKey,
String applicationName)
Returns the token matching a given key
|
Date |
getTokenExpiryTime(Token token)
Returns the expiry time of a token.
|
void |
invalidateToken(String token)
Attempts to invalidate a Token based on the passed in Token key (random hash).
|
void |
invalidateTokensForUser(String username,
String exclusionToken,
String applicationName)
Invalidates all sessions for a user, possibly excluding a specific one.
|
void |
removeExpiredTokens()
Removes all tokens that have exceeded their expiry time.
|
Token |
validateApplicationToken(String tokenKey,
ValidationFactor[] validationFactors)
Validates an application token key given validation factors.
|
Token |
validateUserToken(String userTokenKey,
ValidationFactor[] validationFactors,
String application)
Validates a user token key given validation factors and checks that the user is allowed to authenticate
with the specified application
|
public AliasingAwareTokenAuthenticationManager(TokenAuthenticationManager tokenAuthenticationManager, ApplicationManager applicationManager, AliasManager aliasManager)
public Token authenticateApplication(ApplicationAuthenticationContext authenticationContext, TokenLifetime tokenLifetime) throws InvalidAuthenticationException
TokenAuthenticationManagerauthenticateApplication in interface TokenAuthenticationManagerauthenticationContext - application authentication credentials.tokenLifetime - Requested lifetime of the tokenInvalidAuthenticationException - authentication was not successful because either the application does not exist, the password is incorrect, the application is inactive or there was a problem generating the authentication token.public Token authenticateUser(UserAuthenticationContext authenticateContext) throws InvalidAuthenticationException, OperationFailedException, InactiveAccountException, ApplicationAccessDeniedException, ExpiredCredentialException, ApplicationNotFoundException
authenticateUser in interface TokenAuthenticationManagerInvalidAuthenticationExceptionOperationFailedExceptionInactiveAccountExceptionApplicationAccessDeniedExceptionExpiredCredentialExceptionApplicationNotFoundExceptionTokenAuthenticationManager.authenticateUser(com.atlassian.crowd.model.authentication.UserAuthenticationContext, TokenLifetime)public Token authenticateUser(UserAuthenticationContext authenticateContext, TokenLifetime tokenLifetime) throws InvalidAuthenticationException, OperationFailedException, InactiveAccountException, ApplicationAccessDeniedException, ExpiredCredentialException, ApplicationNotFoundException
TokenAuthenticationManagerRemoteDirectory.authenticate(String, com.atlassian.crowd.embedded.api.PasswordCredential) method is
iteratively called for each assigned directory. If the user does not exist in one directory, the directory is skipped and the next one is examined. If the user does
not exist in any of the assigned directories then an InvalidAuthenticationException is thrown.authenticateUser in interface TokenAuthenticationManagerauthenticateContext - The authentication details for the user.tokenLifetime - Requested lifetime of the tokenInvalidAuthenticationException - The authentication was not successful.OperationFailedException - error thrown by directory implementation when attempting to find or authenticate the user.InactiveAccountException - user account is inactive.ApplicationAccessDeniedException - user does not have access to authenticate with application.ExpiredCredentialException - the user's credentials have expired. The user must change their credentials in order to successfully authenticate.ApplicationNotFoundException - if the application could not be foundpublic Token authenticateUserWithoutValidatingPassword(UserAuthenticationContext authenticateContext) throws InvalidAuthenticationException, OperationFailedException, InactiveAccountException, ApplicationAccessDeniedException, ApplicationNotFoundException
TokenAuthenticationManagerTokenAuthenticationManager.authenticateUser(com.atlassian.crowd.model.authentication.UserAuthenticationContext, TokenLifetime) method.authenticateUserWithoutValidatingPassword in interface TokenAuthenticationManagerauthenticateContext - The authentication details for the user.InvalidAuthenticationException - if the authentication was not successful.OperationFailedException - if the error thrown by directory implementation when attempting to find or authenticate the user.InactiveAccountException - if the user account is inactive.ApplicationAccessDeniedException - if the user does not have access to authenticate with application.ApplicationNotFoundException - if the application could not be foundpublic Token validateApplicationToken(String tokenKey, ValidationFactor[] validationFactors) throws InvalidTokenException
TokenAuthenticationManagervalidateApplicationToken in interface TokenAuthenticationManagertokenKey - returns a valid token corresponding to the tokenKey.validationFactors - validation factors for generating the token hash.InvalidTokenException - if the tokenKey or corresponding client validation factors do not represent a valid application token.public Token validateUserToken(String userTokenKey, ValidationFactor[] validationFactors, String application) throws InvalidTokenException, ApplicationAccessDeniedException, OperationFailedException
TokenAuthenticationManagervalidateUserToken in interface TokenAuthenticationManageruserTokenKey - returns a valid token corresponding to the tokenKey.validationFactors - validation factors for generating the token hash.application - name of application to authenticate with.InvalidTokenException - if the userTokenKey or corresponding validationFactors do not represent a valid SSO token.ApplicationAccessDeniedException - the user is not allowed to authenticate with the application.OperationFailedException - there was an error communicating with an underlying directory when determining if a user is allowed to authenticate with the application (eg. if a user has the appropriate group memberships).public void invalidateToken(String token)
TokenAuthenticationManagerinvalidateToken in interface TokenAuthenticationManagertoken - the token key (random hash) to invalidate.public void removeExpiredTokens()
TokenAuthenticationManagerremoveExpiredTokens in interface TokenAuthenticationManagerpublic User findUserByToken(String key, String applicationName) throws InvalidTokenException, OperationFailedException, ApplicationNotFoundException, ApplicationAccessDeniedException
TokenAuthenticationManagerfindUserByToken in interface TokenAuthenticationManagerkey - the token keyapplicationName - name of the current applicationInvalidTokenException - if the User or Directory cannot be found that relates to the given token,
or the token is associated to an Application and not a UserOperationFailedException - if there was an issue accessing the user from the underlying directoryApplicationNotFoundException - if the application could not be foundApplicationAccessDeniedException - the user is not allowed to authenticate with the application.public Token findUserTokenByKey(String tokenKey, String applicationName) throws InvalidTokenException, ApplicationAccessDeniedException, OperationFailedException, ApplicationNotFoundException
TokenAuthenticationManagerfindUserTokenByKey in interface TokenAuthenticationManagertokenKey - the token keyapplicationName - name of the current applicationInvalidTokenException - if the token cannot be found by the give key,
or the token is associated to an Application and not a UserApplicationAccessDeniedException - the user is not allowed to authenticate with the application.OperationFailedException - if there was an issue accessing the user from the underlying directoryApplicationNotFoundException - if the application could not be foundpublic List<Application> findAuthorisedApplications(User user, String applicationName) throws OperationFailedException, DirectoryNotFoundException, ApplicationNotFoundException
TokenAuthenticationManagerfindAuthorisedApplications in interface TokenAuthenticationManageruser - user to search for.applicationName - name of the current applicationOperationFailedException - if there was an error querying directory.DirectoryNotFoundException - if the directory could not be found.ApplicationNotFoundException - if the application could not be foundpublic void invalidateTokensForUser(String username, String exclusionToken, String applicationName) throws UserNotFoundException, ApplicationNotFoundException
TokenAuthenticationManagerinvalidateTokensForUser in interface TokenAuthenticationManagerexclusionToken - the random hash of a token to leave validapplicationName - name of the current applicationUserNotFoundExceptionApplicationNotFoundExceptionpublic Date getTokenExpiryTime(Token token)
TokenAuthenticationManagergetTokenExpiryTime in interface TokenAuthenticationManagertoken - a tokenCopyright © 2015 Atlassian. All Rights Reserved.