public class AuthenticationEJB extends Object implements Serializable
AuthenticationEJB implements the logic related to authentication, such as login, logout, token retrieval
etc.| Constructor and Description |
|---|
AuthenticationEJB() |
| Modifier and Type | Method and Description |
|---|---|
TokenInfo |
getToken(String tokenID)
Method checks if a token with provided ID exists.
|
TokenInfo |
isTokenValid(String tokenID)
Verifies if the token with the provided ID exists and if it is valid.
|
TokenInfo |
login(char[] username,
char[] password,
String ip,
String[] roleNames)
Method attempts to login the user using
DirectoryServiceAccess. |
TokenInfo |
logout(String tokenID)
Logs the caller out by deleting the token with provided ID.
|
TokenInfo |
renewToken(String tokenID)
Method checks if a token with provided ID exists.
|
public TokenInfo login(char[] username, char[] password, String ip, String[] roleNames) throws RBACException
DirectoryServiceAccess. If the login is successful, a new
Token is created, populated with provided data and persisted. Token information, including the token data
signature is returned to the caller as TokenInfo.username - character array containing login user namepassword - character array containing login passwordip - address of the login attempt callroleNames - array of role preferred role namesIllegalRBACArgumentException - if any of the required parameters is nullAuthAndAuthException - if the user could not be authenticatedRBACException - if there is an error while creating token signaturepublic TokenInfo isTokenValid(String tokenID) throws IllegalRBACArgumentException, TokenInvalidException, DataConsistencyException
tokenID - the id of the tokenIllegalRBACArgumentException - if the token ID is null or emptyTokenInvalidException - if the token is invalid or does not existDataConsistencyException - if there are more tokens with the given IDpublic TokenInfo logout(String tokenID) throws RBACException
tokenID - id of the token to be deleted.IllegalRBACArgumentException - if any of the required parameters is null.DataConsistencyException - if multiple tokens existRBACException - if there was an error communicating with the directory servicepublic TokenInfo getToken(String tokenID) throws RBACException
TokenInfo from it and returns it. Expired tokens may not and will not be retrieved.tokenID - id of the token to be returnedIllegalRBACArgumentException - if any of the required parameters is null.RBACException - if there was an error communicating with the directory serviceDataConsistencyException - if multiple tokens were foundTokenInvalidException - if the token does not existpublic TokenInfo renewToken(String tokenID) throws RBACException
TokenInfo from it and returns it. Expired tokens may not and will
not be renewed. Exception will be thrown if an expired token is being renewed.tokenID - id of the token to be renewed.IllegalRBACArgumentException - if any of the required parameters is null.TokenInvalidException - if the token is invalidDataConsistencyException - if multiple tokens or permissions existRBACException - if there was an error retrieving data from the directory serviceCopyright © 2023 European Spallation Source. All rights reserved.