Class TokenAuthenticationManager
java.lang.Object
com.atlassian.confluence.rpc.auth.TokenAuthenticationManager
Manages tokens used to authenticate users for Confluence's remote API. This implementation
is also responsible for checking permission to access the application and the remote API before
returning tokens.
Uses a cache with an appropriate expiry delay to store the tokens.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionTokenAuthenticationManager
(LoginManager loginManager, ConfluenceUserResolver userResolver, PermissionManager permissionManager, SettingsManager settingsManager, com.atlassian.event.api.EventPublisher eventPublisher, SharedDataManager clusterSharedDataManager) -
Method Summary
Modifier and TypeMethodDescriptionboolean
hasUseConfluencePermission
(com.atlassian.user.User user) Determines whether user has access to ConfluenceLogs the user with username and password into the Remote API systemboolean
Logs the user out of the RPC systemReturns the anonymous userRetrieves the user for a particular token
-
Field Details
-
CACHE_KEY
-
-
Constructor Details
-
Method Details
-
login
Logs the user with username and password into the Remote API systemThe token is stored for a period of time, and invalidated after an idle period.
- Parameters:
username
- The user's login namepassword
- The password- Returns:
- The authentication token for use with other RPC calls
- Throws:
AuthenticationFailedException
- if a user called username could not be found or the password was incorrectRemoteException
-
logout
Logs the user out of the RPC system- Parameters:
token
- The authenticated user token- Returns:
- true if the logout was successful, otherwise false
- Throws:
RemoteException
- if the user could not be logged out
-
makeNonAnonymousConfluenceUserFromToken
public ConfluenceUser makeNonAnonymousConfluenceUserFromToken(String token) throws InvalidSessionException Retrieves the user for a particular token- Parameters:
token
- The authenticated user token- Returns:
- The User for the token
- Throws:
InvalidSessionException
- if a user could not be retrieved for token- Since:
- 5.2
-
makeAnonymousConfluenceUser
Returns the anonymous user- Returns:
- The anonymous user (null)
- Throws:
NotPermittedException
- if anonymous access to the Remote API is disabled- Since:
- 5.2
-
hasUseConfluencePermission
public boolean hasUseConfluencePermission(com.atlassian.user.User user) Determines whether user has access to Confluence- Parameters:
user
- The User to be checked- Returns:
- true if the user has access, false otherwise
-