public interface UserManager
The following code sample illustrates how to use this class to retrieve the list of logged-in users.
UserManager userManager = tapkeyServiceFactory.getUserManager(); List<String> users = userManager.getUsers(); // Now, users contains a list of IDs of all logged-in users. Usually, users.size() will be 1, // however, it is possible to log in multiple users at the same time.
The exemplary code below demonstrates how to log in a user:
UserManager userManager = tapkeyServiceFactory.getUserManager(); userManager.logInAsync(tapkeyAccessToken, ct);Implementors have to make sure that a token refresh handler was set via the TapkeyServiceFactory builder prior to logging in any users.
Modifier and Type | Method and Description |
---|---|
net.tpky.mc.manager.HttpAuthenticationProvider |
getHttpAuthenticationProvider()
Reserved for internal use.
|
List<String> |
getUsers()
Returns IDs of the users who are currently logged in.
|
Promise<String> |
logInAsync(String accessToken,
CancellationToken cancellationToken)
Logs in a user with a Tapkey access token.
|
Promise<Void> |
logOutAsync(String userId,
CancellationToken cancellationToken)
Logs out a user with a Tapkey access token.
|
void |
updateAccessToken(String userId,
String accessToken)
Replaces the access token for the specified user.
|
List<String> getUsers()
Promise<String> logInAsync(String accessToken, CancellationToken cancellationToken)
accessToken
- the Tapkey access token to be used for logging in the user.cancellationToken
- can be used to get notified on cancel events.Promise<Void> logOutAsync(String userId, CancellationToken cancellationToken)
userId
- the ID of the user to be logged out.cancellationToken
- can be used to get notified on cancel events.void updateAccessToken(String userId, String accessToken)
userId
- the ID of the user whose access token is to be replaced.accessToken
- the new access tokennet.tpky.mc.manager.HttpAuthenticationProvider getHttpAuthenticationProvider()