|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.crowd.manager.authentication.TokenAuthenticationManagerImpl
public class TokenAuthenticationManagerImpl
| Constructor Summary | |
|---|---|
TokenAuthenticationManagerImpl()
|
|
| Method Summary | |
|---|---|
Token |
authenticateApplication(ApplicationAuthenticationContext authenticationContext)
Authenticates an application and generates an authentication token. |
Token |
authenticateUser(UserAuthenticationContext authenticateContext)
Authenticates a user and and generates an authentication token. |
Token |
authenticateUser(UserAuthenticationContext authenticationContext,
boolean validatePassword,
boolean ignoreCache)
|
Token |
authenticateUserWithoutValidatingPassword(UserAuthenticationContext authenticateContext)
Feigns the authentication process for a user and creates a token for the authentication without validating the password. |
java.util.List<Application> |
findAuthorisedApplications(User user,
java.lang.String applicationName)
Returns a list of applications a user is authorised to authenticate with. |
User |
findUserByToken(java.lang.String tokenKey,
java.lang.String applicationName)
Will find a user via the passed in token key. |
protected Token |
generateApplicationToken(ApplicationAuthenticationContext authenticationContext)
|
protected Token |
generateUserToken(long directoryID,
AuthenticationContext authenticationContext)
This method will return a Token based on the passed in parameters. |
protected Token |
genericValidateToken(java.lang.String token,
ValidationFactor[] validationFactors)
Will validate a token key with the given ValidationFactor's
against one (if it exists) in the datastore. |
void |
invalidateToken(java.lang.String tokenKey)
Attempts to invalidate a Token based on the passed in Token key (random hash). |
boolean |
isAllowedToAuthenticate(java.lang.String username,
long directoryId,
Application application)
Determines if a user is authorised to authenticate with a given application. |
boolean |
isAllowedToAuthenticate(Token token,
Application application)
|
boolean |
isAllowedToAuthenticate(Token token,
Application application,
boolean ignoreCache)
|
protected boolean |
isExpired(Token token)
|
void |
removeExpiredTokens()
Removes all tokens that have exceeded their expiry time. |
java.util.List<Token> |
searchTokens(EntityQuery query)
Returns a list of users matching the given query. |
void |
setApplicationDao(ApplicationDAO applicationDao)
|
void |
setApplicationManager(ApplicationManager applicationManager)
|
void |
setApplicationService(ApplicationService applicationService)
|
void |
setCacheManager(CacheManager cacheManager)
|
void |
setDirectoryManager(DirectoryManager directoryManager)
|
void |
setEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher)
|
void |
setPropertyManager(PropertyManager propertyManager)
|
void |
setTokenFactory(TokenFactory tokenFactory)
|
void |
setTokenManager(TokenManager tokenManager)
|
Token |
validateApplicationToken(java.lang.String tokenKey,
ValidationFactor[] clientValidationFactors)
Validates an application token key given validation factors. |
Token |
validateUserToken(java.lang.String userTokenKey,
ValidationFactor[] validationFactors,
java.lang.String applicationName)
Validates a user token key given validation factors and checks that the user is allowed to authenticate with the specified application |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TokenAuthenticationManagerImpl()
| Method Detail |
|---|
public void invalidateToken(java.lang.String tokenKey)
TokenAuthenticationManager
invalidateToken in interface TokenAuthenticationManagertokenKey - the token key (random hash) to invalidate.public java.util.List<Token> searchTokens(EntityQuery query)
TokenAuthenticationManager
searchTokens in interface TokenAuthenticationManagerquery - entity query for Entity.TOKEN.
Token matching the search criteria.public void removeExpiredTokens()
TokenAuthenticationManager
removeExpiredTokens in interface TokenAuthenticationManager
public User findUserByToken(java.lang.String tokenKey,
java.lang.String applicationName)
throws InvalidTokenException,
OperationFailedException,
ApplicationAccessDeniedException
TokenAuthenticationManager
findUserByToken in interface TokenAuthenticationManagertokenKey - the token keyapplicationName - name of the current application
InvalidTokenException - 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 User
OperationFailedException - if there was an issue accessing the user from the underlying directory
ApplicationAccessDeniedException - the user is not allowed to authenticate with the application.
public java.util.List<Application> findAuthorisedApplications(User user,
java.lang.String applicationName)
throws OperationFailedException,
DirectoryNotFoundException
TokenAuthenticationManager
findAuthorisedApplications in interface TokenAuthenticationManageruser - user to search for.applicationName - name of the current application
OperationFailedException - if there was an error querying directory.
DirectoryNotFoundException - if the directory could not be found.
public Token authenticateApplication(ApplicationAuthenticationContext authenticationContext)
throws InvalidAuthenticationException
TokenAuthenticationManager
authenticateApplication in interface TokenAuthenticationManagerauthenticationContext - application authentication credentials.
InvalidAuthenticationException - 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 authenticationContext,
boolean validatePassword,
boolean ignoreCache)
throws InvalidAuthenticationException,
OperationFailedException,
InactiveAccountException,
ApplicationAccessDeniedException,
ExpiredCredentialException
InvalidAuthenticationException
OperationFailedException
InactiveAccountException
ApplicationAccessDeniedException
ExpiredCredentialException
public Token authenticateUser(UserAuthenticationContext authenticateContext)
throws InvalidAuthenticationException,
OperationFailedException,
InactiveAccountException,
ApplicationAccessDeniedException,
ExpiredCredentialException
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.
InvalidAuthenticationException - 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.
public Token authenticateUserWithoutValidatingPassword(UserAuthenticationContext authenticateContext)
throws InvalidAuthenticationException,
OperationFailedException,
InactiveAccountException,
ApplicationAccessDeniedException
TokenAuthenticationManagerTokenAuthenticationManager.authenticateUser(com.atlassian.crowd.model.authentication.UserAuthenticationContext) 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.
public Token validateApplicationToken(java.lang.String tokenKey,
ValidationFactor[] clientValidationFactors)
throws InvalidTokenException
TokenAuthenticationManager
validateApplicationToken in interface TokenAuthenticationManagertokenKey - returns a valid token corresponding to the tokenKey.clientValidationFactors - 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(java.lang.String userTokenKey,
ValidationFactor[] validationFactors,
java.lang.String applicationName)
throws InvalidTokenException,
ApplicationAccessDeniedException,
OperationFailedException
TokenAuthenticationManager
validateUserToken in interface TokenAuthenticationManageruserTokenKey - returns a valid token corresponding to the tokenKey.validationFactors - validation factors for generating the token hash.applicationName - 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).
protected Token generateUserToken(long directoryID,
AuthenticationContext authenticationContext)
throws InvalidTokenException
Token based on the passed in parameters.
If a token already exists in the datastore, this token will be returned with an updated lastAccessed time.
If a token is not found based on the passed in parameters a new Token
will be generated an stored in the datastore.
directoryID - the directoryID you wish to generate a Token forauthenticationContext - holder for the required attributes to authenticate against the Crowd server
Token
InvalidTokenException - if there was an issue generating the key for a token.
protected Token generateApplicationToken(ApplicationAuthenticationContext authenticationContext)
throws InvalidTokenException
InvalidTokenException
protected Token genericValidateToken(java.lang.String token,
ValidationFactor[] validationFactors)
throws InvalidTokenException
ValidationFactor's
against one (if it exists) in the datastore.
token - the key of a TokenvalidationFactors - the ValidationFactor's that are being used for authentication
InvalidTokenException - thrown if the token keys are not equal, or the token has expired, or the token does not existprotected boolean isExpired(Token token)
public boolean isAllowedToAuthenticate(java.lang.String username,
long directoryId,
Application application)
throws OperationFailedException,
DirectoryNotFoundException
application - application the user wants to authenticate with.username - the username of the user that wants to authenticate with the application.directoryId - the directoryId of the user that wants to authenticate with the application.
true iff the user is authorised to authenticate with the application.
OperationFailedException - if the directory implementation could not be loaded when performing a membership check.
DirectoryNotFoundException
public boolean isAllowedToAuthenticate(Token token,
Application application,
boolean ignoreCache)
throws OperationFailedException,
DirectoryNotFoundException
OperationFailedException
DirectoryNotFoundException
public boolean isAllowedToAuthenticate(Token token,
Application application)
throws OperationFailedException,
DirectoryNotFoundException
OperationFailedException
DirectoryNotFoundExceptionpublic void setTokenManager(TokenManager tokenManager)
public void setApplicationDao(ApplicationDAO applicationDao)
public void setTokenFactory(TokenFactory tokenFactory)
public void setCacheManager(CacheManager cacheManager)
public void setEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher)
public void setPropertyManager(PropertyManager propertyManager)
public void setDirectoryManager(DirectoryManager directoryManager)
public void setApplicationManager(ApplicationManager applicationManager)
public void setApplicationService(ApplicationService applicationService)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||