public class TokenAuthenticationManager extends Object
Uses a cache with an appropriate expiry delay to store the tokens.
| Constructor and Description |
|---|
TokenAuthenticationManager(LoginManager loginManager,
UserAccessor userAccessor,
PermissionManager permissionManager,
SettingsManager settingsManager,
com.atlassian.event.api.EventPublisher eventPublisher,
SharedDataManager clusterSharedDataManager) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasUseConfluencePermission(com.atlassian.user.User user)
Determines whether user has access to Confluence
|
String |
login(String username,
String password)
Logs the user with username and password into the Remote API system
|
boolean |
logout(String token)
Logs the user out of the RPC system
|
ConfluenceUser |
makeAnonymousConfluenceUser()
Returns the anonymous user
|
ConfluenceUser |
makeNonAnonymousConfluenceUserFromToken(String token)
Retrieves the user for a particular token
|
public static final String CACHE_KEY
public TokenAuthenticationManager(LoginManager loginManager, UserAccessor userAccessor, PermissionManager permissionManager, SettingsManager settingsManager, com.atlassian.event.api.EventPublisher eventPublisher, SharedDataManager clusterSharedDataManager)
public String login(String username, String password) throws RemoteException
The token is stored for a period of time, and invalidated after an idle period.
username - The user's login namepassword - The passwordAuthenticationFailedException - if a user called username could not be found or the password was incorrectRemoteExceptionpublic boolean logout(String token) throws RemoteException
token - The authenticated user tokenRemoteException - if the user could not be logged outpublic ConfluenceUser makeNonAnonymousConfluenceUserFromToken(String token) throws InvalidSessionException
token - The authenticated user tokenInvalidSessionException - if a user could not be retrieved for tokenpublic ConfluenceUser makeAnonymousConfluenceUser() throws NotPermittedException
NotPermittedException - if anonymous access to the Remote API is disabledpublic boolean hasUseConfluencePermission(com.atlassian.user.User user)
user - The User to be checkedCopyright © 2003–2020 Atlassian. All rights reserved.