public class TokenAuthenticationServiceImpl extends Object implements TokenAuthenticationService
TokenAuthenticationService
.
The token is generated by the UUID.randomUUID()
method which guarantees its uniqueness. The storage back-end
is a SQL Directory.
Constructor and Description |
---|
TokenAuthenticationServiceImpl() |
Modifier and Type | Method and Description |
---|---|
String |
acquireToken(String userName,
String applicationName,
String deviceId,
String deviceDescription,
String permission)
Acquires a unique token for the specified user, application, and device.
|
String |
getToken(String userName,
String applicationName,
String deviceId)
Gets the token for the specified user, application, and device.
|
DocumentModelList |
getTokenBindings(String userName)
Gets the token bindings for the specified user.
|
String |
getUserName(String token)
Gets the user name bound to the specified token.
|
void |
revokeToken(String token)
Removes the token from the back-end.
|
public String acquireToken(String userName, String applicationName, String deviceId, String deviceDescription, String permission) throws TokenAuthenticationException
TokenAuthenticationService
If such a token exist in the back-end for the specified (userName, applicationName, deviceId) triplet, just returns it, else generates it and stores it in the back-end with the triplet attributes, the specified device description and permission.
acquireToken
in interface TokenAuthenticationService
TokenAuthenticationException
- if one of the required parameters is null or empty (all parameters are
required except for the device description)public String getToken(String userName, String applicationName, String deviceId) throws TokenAuthenticationException
TokenAuthenticationService
getToken
in interface TokenAuthenticationService
TokenAuthenticationException
- if one of the required parameters is null or empty (all parameters are
required except for the device description)public String getUserName(String token)
TokenAuthenticationService
getUserName
in interface TokenAuthenticationService
public void revokeToken(String token)
TokenAuthenticationService
revokeToken
in interface TokenAuthenticationService
public DocumentModelList getTokenBindings(String userName)
TokenAuthenticationService
getTokenBindings
in interface TokenAuthenticationService
Copyright © 2015 Nuxeo SA. All rights reserved.