Package com.iizix.user
Class UserIdentifier
java.lang.Object
com.iizix.user.UserIdentifier
- Direct Known Subclasses:
SessionUserIdentifier
The User identifier class holds the information about a user or a returning user. The User may, if the application allows it, run several individual session or the same virtual session in parallel. This is configurable, and allows the same user to run different independent sessions by assigning a session ID. In this case, the class
SessionUserIdentifier
is used.- Author:
- Christopher Mindus
Constructor Summary
Method Summary
Modifier and TypeMethodDescriptioncreateSessionUserIdentifier
(String sessionID) Creates a SessionUserIdentifier from this instance.boolean
Checks if another UserIdentifier equals this one.getLoginContext
(String name, ArrayList<TextOutputCallback> output) Gets the login context for the user.Gets the password specified in the user session.final String
Gets the User ID.final int
hashCode()
Hash code, unique for each user identifier.protected String
Formats the value as a string to add toparamString
.toString()
Returns a string representation of this user identifier and its values.void
updatePassword
(String password) Updates the password for the user.
Constructor Details
UserIdentifier
Constructor.- Parameters:
userID
- User ID, non-empty, not null.password
- The password, non-empty, not null.- Throws:
NullPointerException
- If any parameter is null.IllegalArgumentException
- If any parameter is empty.
Method Details
createSessionUserIdentifier
Creates a SessionUserIdentifier from this instance.- Parameters:
sessionID
- The session ID, non-empty, not null.- Throws:
NullPointerException
- If any parameter is null.IllegalArgumentException
- If any parameter is empty.
getUserID
Gets the User ID.updatePassword
Updates the password for the user.- Parameters:
password
- The updated password.- Throws:
NullPointerException
- If password is null.IllegalArgumentException
- If any parameter is empty.
getPassword
Gets the password specified in the user session. Once retrieved by the authentication system, the password is cleared and no longer available.- Returns:
- The password, null if already retrieved.
equals
Checks if another UserIdentifier equals this one.Comparison includes the Session ID.
Password is excluded in the verification as it is not available once checked.
hashCode
public final int hashCode()Hash code, unique for each user identifier.paramString
Formats the value as a string to add toparamString
.toString
Returns a string representation of this user identifier and its values.getLoginContext
public LoginContext getLoginContext(String name, ArrayList<TextOutputCallback> output) throws LoginException Gets the login context for the user.- Parameters:
name
- The name of the configuration entry.output
- The array that is filled with output texts during login.- Returns:
- The login context.
- Throws:
LoginException
- if the caller-specifiedname
does not appear in theConfiguration
and there is noConfiguration
entry for "other", or if the caller-specifiedcallbackHandler
isnull
.SecurityException
- if a SecurityManager is set and the caller does not have AuthPermission("createLoginContext.name"), or if a configuration entry for name does not exist and the caller does not additionally have AuthPermission("createLoginContext.other").