@Path(value="session") @Produces(value={"application/xml","application/json"}) @Consumes(value={"application/xml","application/json"}) public class TokenResource extends AbstractResource
Modifier and Type | Field and Description |
---|---|
static IntegerSystemProperty |
TOKEN_CACHE_CONTROL_MAX_AGE_SYSTEM_PROPERTY
Set a system property with this name to define the max-age of the 'Cache-Control' header in the response
of the token validation and get user operations on this resource.
|
request, uriInfo
Constructor and Description |
---|
TokenResource(TokenController tokenController) |
Modifier and Type | Method and Description |
---|---|
javax.ws.rs.core.Response |
authenticateUser(AuthenticationContextEntity authenticationContext,
boolean validatePassword,
long durationInSeconds)
Create new session token valid for duration seconds, or for the server default session timeout if no duration is specified
or if duration is longer than the server default session timeout.
|
javax.ws.rs.core.Response |
deleteTokensForUser(String username,
String exclusionToken)
Invalidate all tokens for a given user name.
|
javax.ws.rs.core.Response |
getSession(String token)
Retrieves the token with the authenticated user expanded.
|
javax.ws.rs.core.Response |
invalidateToken(String token)
Invalidates the Crowd SSO token.
|
javax.ws.rs.core.Response |
validateToken(String token,
ValidationFactorEntityList validationFactors)
Validates the session token.
|
getApplicationName, getBaseUri, setApplicationName, setRequest, setUriInfo
public static final IntegerSystemProperty TOKEN_CACHE_CONTROL_MAX_AGE_SYSTEM_PROPERTY
public TokenResource(TokenController tokenController)
@POST public javax.ws.rs.core.Response authenticateUser(AuthenticationContextEntity authenticationContext, @DefaultValue(value="true") @QueryParam(value="validate-password") boolean validatePassword, @DefaultValue(value="-1") @QueryParam(value="duration") long durationInSeconds) throws InvalidAuthenticationException, InactiveAccountException, ExpiredCredentialException, ApplicationAccessDeniedException, OperationFailedException
Create new session token valid for duration seconds, or for the server default session timeout if no duration is specified or if duration is longer than the server default session timeout.
Either the user password needs to be valid or the validate-password
query param must be set to false.
If an ongoing session already exists for the same authentication credentials and validation factors, then that session token is returned.
authenticationContext
- authentication informationvalidatePassword
- true if the password should be validated (optional, defaults to true)durationInSeconds
- requested duration of the token, in seconds (optional, defaults to server session duration)InvalidAuthenticationException
InactiveAccountException
ExpiredCredentialException
ApplicationAccessDeniedException
OperationFailedException
@DELETE @Path(value="{token}") public javax.ws.rs.core.Response invalidateToken(@PathParam(value="token") String token)
token
- the token to invalidate@POST @Path(value="{token}") public javax.ws.rs.core.Response validateToken(@PathParam(value="token") String token, ValidationFactorEntityList validationFactors) throws InvalidTokenException, ApplicationAccessDeniedException, OperationFailedException
token
- Crowd SSO tokenvalidationFactors
- list of validation factorsInvalidTokenException
ApplicationAccessDeniedException
OperationFailedException
@GET @Path(value="{token}") public javax.ws.rs.core.Response getSession(@PathParam(value="token") String token) throws InvalidTokenException, OperationFailedException, ApplicationAccessDeniedException
token
- the token to retrieveInvalidTokenException
OperationFailedException
ApplicationAccessDeniedException
@DELETE public javax.ws.rs.core.Response deleteTokensForUser(@QueryParam(value="username") String username, @QueryParam(value="exclude") String exclusionToken)
Invalidate all tokens for a given user name.
Optionally, a token key can be saved from invalidation if specified in the exclude
param
username
- The user for which the tokens will be invalidatedexclusionToken
- The token to excludeCopyright © 2021 Atlassian. All rights reserved.
View cookie preferences