public class DefaultAccessTokenService extends Object implements AccessTokenService
Constructor and Description |
---|
DefaultAccessTokenService(AccessTokenDao accessTokenDao,
AccessTokenGenerator accessTokenGenerator,
BambooAuthenticationContext bambooAuthenticationContext,
BambooPermissionManager bambooPermissionManager,
com.atlassian.event.api.EventPublisher eventPublisher,
BambooUserManager bambooUserManager,
AuditLogService auditLogService) |
Modifier and Type | Method and Description |
---|---|
Optional<AccessToken> |
authenticate(String rawToken)
Authenticate by raw token
|
RawAccessToken |
create(CreateAccessTokenRequest createAccessTokenRequest)
Create new access token for user.
|
void |
deleteByTokenId(String tokenId)
Delete one token with tokenId.
|
void |
deleteByUserName(String userName)
Delete all tokens for given user name
|
List<AccessToken> |
getAccessTokensByUserName(String userName)
Get All tokens for given user name.
|
public DefaultAccessTokenService(AccessTokenDao accessTokenDao, AccessTokenGenerator accessTokenGenerator, BambooAuthenticationContext bambooAuthenticationContext, BambooPermissionManager bambooPermissionManager, com.atlassian.event.api.EventPublisher eventPublisher, BambooUserManager bambooUserManager, AuditLogService auditLogService)
public Optional<AccessToken> authenticate(@NotNull String rawToken)
AccessTokenService
authenticate
in interface AccessTokenService
rawToken
- created by AccessTokenService.create(CreateAccessTokenRequest)
methodAccessToken
When user exists & is enabled and token is valid,
otherwise Optional.empty()
@NotNull public RawAccessToken create(@NotNull CreateAccessTokenRequest createAccessTokenRequest) throws TokenLimitExceededException, CreateTokenFailedException, TokenWithNameExistsException
AccessTokenService
create
in interface AccessTokenService
RawAccessToken
, RawAccessToken.getRawToken()
can be used in AccessTokenService.authenticate(String)
TokenLimitExceededException
- when user already has maximum number of tokensCreateTokenFailedException
- when can not generate unique token idTokenWithNameExistsException
- when user already has token with name@NotNull public List<AccessToken> getAccessTokensByUserName(@NotNull String userName)
AccessTokenService
getAccessTokensByUserName
in interface AccessTokenService
public void deleteByTokenId(@NotNull String tokenId)
AccessTokenService
deleteByTokenId
in interface AccessTokenService
public void deleteByUserName(@NotNull String userName) throws UnauthorisedException
AccessTokenService
deleteByUserName
in interface AccessTokenService
UnauthorisedException
- on non-admin tries to delete other user tokensCopyright © 2019 Atlassian Software Systems Pty Ltd. All rights reserved.