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
|
com.atlassian.user.User |
makeAnonymousUser()
Deprecated.
since 5.2. Use
makeAnonymousConfluenceUser() instead. |
ConfluenceUser |
makeNonAnonymousConfluenceUserFromToken(String token)
Retrieves the user for a particular token
|
com.atlassian.user.User |
makeNonAnonymousUserFromToken(String token)
Deprecated.
since 5.2. Use
makeNonAnonymousConfluenceUserFromToken(String) instead. |
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 incorrectRemoteException
public 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 token@Deprecated public com.atlassian.user.User makeNonAnonymousUserFromToken(String token) throws InvalidSessionException
makeNonAnonymousConfluenceUserFromToken(String)
instead.InvalidSessionException
public ConfluenceUser makeAnonymousConfluenceUser() throws NotPermittedException
NotPermittedException
- if anonymous access to the Remote API is disabled@Deprecated public com.atlassian.user.User makeAnonymousUser() throws NotPermittedException
makeAnonymousConfluenceUser()
instead.NotPermittedException
public boolean hasUseConfluencePermission(com.atlassian.user.User user)
user
- The User to be checkedCopyright © 2003–2017 Atlassian. All rights reserved.