public class TokenController extends Object
| Constructor and Description |
|---|
TokenController(TokenAuthenticationManager tokenAuthenticationManager) |
| Modifier and Type | Method and Description |
|---|---|
SessionEntity |
authenticateUser(String applicationName,
String username,
String password,
TokenLifetime tokenDuration,
Collection<ValidationFactorEntity> validationFactorEntities,
URI baseUri)
Authenticates a user for the given application.
|
SessionEntity |
authenticateUserWithoutValidatingPassword(String applicationName,
String username,
Collection<ValidationFactorEntity> validationFactorEntities,
URI baseUri)
Feigns the authentication process for a user and creates a token for the authentication without validating the password.
|
SessionEntity |
getSessionFromToken(String tokenKey,
String applicationName,
URI baseUri)
Returns the session associated with the Crowd SSO token.
|
void |
invalidateAllTokens()
Invalidates all tokens.
|
void |
invalidateToken(String token)
Invalidates a token.
|
void |
invalidateTokensForUser(String username,
String exclusionToken,
String applicationName) |
SessionEntity |
validateToken(String applicationName,
String token,
Collection<ValidationFactorEntity> validationFactorEntities,
URI baseUri)
Validates a Crowd SSO token and creates a new token with an updated last accessed date (for the internal token representation).
|
public TokenController(TokenAuthenticationManager tokenAuthenticationManager)
public SessionEntity authenticateUser(String applicationName, String username, String password, TokenLifetime tokenDuration, Collection<ValidationFactorEntity> validationFactorEntities, URI baseUri) throws InvalidAuthenticationException, InactiveAccountException, ExpiredCredentialException, ApplicationAccessDeniedException, OperationFailedException
applicationName - name of the applicationusername - name of the userpassword - password of the usertokenDuration - Requested token lifetime.validationFactorEntities - validation factorsbaseUri - base URI of the REST serviceInvalidAuthenticationException - if the authentication was not successfulInactiveAccountException - if the user account is marked as inactiveExpiredCredentialException - if the user credential has expired and the user needs to set a new passwordApplicationAccessDeniedException - if the user does not have access to authenticate with the applicationOperationFailedException - if the operation failed for any other reasonpublic SessionEntity authenticateUserWithoutValidatingPassword(String applicationName, String username, Collection<ValidationFactorEntity> validationFactorEntities, URI baseUri) throws InvalidAuthenticationException, InactiveAccountException, ExpiredCredentialException, ApplicationAccessDeniedException, OperationFailedException
This method only be used to generate a token for a user that has already authenticated credentials via some other means (eg. SharePoint NTLM connector) as this method bypasses any password checks.
If you want actual password authentication, use the authenticateUser(String, String, String, TokenLifetime, java.util.Collection, java.net.URI) method.
applicationName - name of the applicationusername - name of the uservalidationFactorEntities - validation factorsbaseUri - base URI of the REST serviceInvalidAuthenticationException - if the authentication was not successfulInactiveAccountException - if the user account is marked as inactiveExpiredCredentialException - if the user credential has expired and the user needs to set a new passwordApplicationAccessDeniedException - if the user does not have access to authenticate with the applicationOperationFailedException - if the operation failed for any other reasonpublic void invalidateToken(String token)
token - Token to invalidatepublic void invalidateAllTokens()
public SessionEntity validateToken(String applicationName, String token, Collection<ValidationFactorEntity> validationFactorEntities, URI baseUri) throws InvalidTokenException, ApplicationAccessDeniedException, OperationFailedException
applicationName - Name of the applicationtoken - Crowd SSO tokenvalidationFactorEntities - validation factorsbaseUri - base URI of the REST serviceInvalidTokenException - if the token or validation factors are not valid.ApplicationAccessDeniedException - if the user is not allowed to authenticate with the application.OperationFailedException - if the application failed for any other reason.public SessionEntity getSessionFromToken(String tokenKey, String applicationName, URI baseUri) throws InvalidTokenException, OperationFailedException, ApplicationAccessDeniedException
tokenKey - token for the sessionapplicationName - name of the current applicationbaseUri - base URI of the REST serviceInvalidTokenException - if the token could not be foundOperationFailedException - if the operation failed for any other reasonApplicationAccessDeniedException - if the user does not have access to authenticate with the applicationpublic void invalidateTokensForUser(String username, String exclusionToken, String applicationName) throws UserNotFoundException, ApplicationNotFoundException
Copyright © 2016 Atlassian. All rights reserved.