|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@PublicRequestContext @WebServlet(value="/ws/level-0/authentication") public interface PublicAuthenticationService
Service interface allowing users to authenticate their session.
Method Summary | |
---|---|
boolean |
authenticate(String username,
String password)
Authenticates the user's session using password auth. |
UUID |
authenticateAndGetApiKey(String username,
char[] password,
Set<String> requiredRoles)
Combines authentication and api key retrieval into a single call to avoid that a caller needs to keep track of the session. |
UUID |
getApiKey(Set<String> requiredRoles)
Returns the current API key that allows login and session less access to protected services that fall under the roles that were specified with the call, or 'null' if no API key is available that satisfies this requirement. |
String |
getUserDisplayName()
Returns the display name of the authenticated user. |
Set<String> |
getUserRoles()
Returns the assigned roles of the authenticated user. |
boolean |
isAuthenticated()
Returns true if the user's session is authenticated. |
boolean |
logout()
Logs the authenticated user out and returns true on success. |
Method Detail |
---|
boolean isAuthenticated()
boolean authenticate(String username, String password) throws IllegalRequestException
username
- The name of the user to authenticate.password
- The corresponding password.
IllegalRequestException
- In case of this method is called from a non-confidential (non-secured) connection.boolean logout()
UUID getApiKey(Set<String> requiredRoles) throws IllegalRequestException
ApiKeyHandlingFilter
) the methods
can be accessed in exactly the same way as if a user would first authenticate a session and then call the desired method in the same
session (assuming that the users privilege covers the required roles). Using API keys simplifies calls and client implementations
as the keys can be added to endpoint URLs which do then no longer need additional auth or session handling when being used.
The method may return different API keys depending on the roles granted to the requesting user and the roles given with the call.
This is to avoid that un-privileged users can access something they shouldn't. API keys may further expire (default validity
~ 1 week) to reduce the risk of unprivileged access coming from lost API keys (under normal circumstances they shouldn't get lost).
If an API key expired a subsequent call to a protected method will behave in exactly the same way as if the user was not
authenticated. The default operation of a client should be to request a new API key and replace the one it had used before.
requiredRoles
- The roles that must be available when using the given API key.
IllegalRequestException
- In case of this method is called from a non-confidential (non-secured) connection.UUID authenticateAndGetApiKey(String username, char[] password, Set<String> requiredRoles) throws IllegalRequestException
requiredRoles
- The roles that must be available when using the given API key.username
- The name of the user to authenticate.password
- The corresponding password.
IllegalRequestException
- In case of this method is called from a non-confidential (non-secured) connection.String getUserDisplayName()
Set<String> getUserRoles()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |