org.objectweb.jonas.security.realm.principals
Class User

java.lang.Object
  extended by org.objectweb.jonas.security.realm.principals.User
All Implemented Interfaces:
java.io.Serializable, java.security.Principal, UserMBean
Direct Known Subclasses:
LDAPUser

public class User
extends java.lang.Object
implements java.security.Principal, java.io.Serializable, UserMBean

This class define the User class which represent a user by its name, password, etc.

Author:
Florent Benoit (initial developer), Alexandre Thaveau (add DN for the certificates in method setName), Marc-Antoine Bourgeot (add DN for the certificates in method setName)
See Also:
Serialized Form

Field Summary
protected static java.lang.String SEPARATOR
          Separator of the groups/roles
 
Constructor Summary
User()
          Constructor
User(java.lang.String name, java.lang.String password)
          Constructor with a given login / password
 
Method Summary
 void addGroup(java.lang.String group)
          Add the specified group to this user
 void addRole(java.lang.String role)
          Add a role to this user
 java.lang.String[] getArrayGroups()
          Get the groups
 java.lang.String[] getArrayRoles()
          Get the roles
 java.util.ArrayList getCombinedRoles()
          Get the combined roles of this user
 java.lang.String getGroups()
          Get the groups
 HashPassword getHashPassword()
          Set the hashed password of this user
 java.lang.String getName()
          Get the name of this user
 java.lang.String getPassword()
          Get the password of this user
 java.lang.String getRoles()
          Get the roles
 void removeGroup(java.lang.String group)
          Remove a group from this user
 void removeRole(java.lang.String role)
          Remove a role from this user
 void setCombinedRoles(java.util.ArrayList combinedRoles)
          Set the combined roles of this user
 void setGroups(java.lang.String groups)
          Set the groups of the user
protected  void setHashPassword(HashPassword hashPassword)
          Set the hashed password of this user
 void setName(java.lang.String name)
          Set the name of this user
 void setPassword(java.lang.String password)
          Set the password of this user
 void setRoles(java.lang.String roles)
          Set the roles of the user
 java.lang.String toString()
          Use the XML representation of this object
 java.lang.String toXML()
          String representation of the user
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.security.Principal
equals, hashCode
 

Field Detail

SEPARATOR

protected static final java.lang.String SEPARATOR
Separator of the groups/roles

See Also:
Constant Field Values
Constructor Detail

User

public User()
Constructor


User

public User(java.lang.String name,
            java.lang.String password)
Constructor with a given login / password

Parameters:
name - the given name
password - the given password
Method Detail

setName

public void setName(java.lang.String name)
Set the name of this user

Parameters:
name - Name of the user

getName

public java.lang.String getName()
Get the name of this user

Specified by:
getName in interface java.security.Principal
Specified by:
getName in interface UserMBean
Returns:
the name of this user

getPassword

public java.lang.String getPassword()
Get the password of this user

Specified by:
getPassword in interface UserMBean
Returns:
the password of this user

setPassword

public void setPassword(java.lang.String password)
Set the password of this user

Specified by:
setPassword in interface UserMBean
Parameters:
password - password of the user

setHashPassword

protected void setHashPassword(HashPassword hashPassword)
Set the hashed password of this user

Parameters:
hashPassword - hashed password of this user

getHashPassword

public HashPassword getHashPassword()
Set the hashed password of this user

Returns:
hashPassword hashed password of this user

setGroups

public void setGroups(java.lang.String groups)
Set the groups of the user

Parameters:
groups - the comma separated list of the groups of the user

getGroups

public java.lang.String getGroups()
Get the groups

Returns:
the comma separated list of groups

getArrayGroups

public java.lang.String[] getArrayGroups()
Get the groups

Specified by:
getArrayGroups in interface UserMBean
Returns:
the array of the groups

setRoles

public void setRoles(java.lang.String roles)
Set the roles of the user

Parameters:
roles - the comma separated list of the roles of the user

addGroup

public void addGroup(java.lang.String group)
Add the specified group to this user

Specified by:
addGroup in interface UserMBean
Parameters:
group - the group to add

addRole

public void addRole(java.lang.String role)
Add a role to this user

Specified by:
addRole in interface UserMBean
Parameters:
role - the given role

removeGroup

public void removeGroup(java.lang.String group)
Remove a group from this user

Specified by:
removeGroup in interface UserMBean
Parameters:
group - the given group

removeRole

public void removeRole(java.lang.String role)
Remove a role from this user

Specified by:
removeRole in interface UserMBean
Parameters:
role - the given role

getRoles

public java.lang.String getRoles()
Get the roles

Returns:
the array of the roles

setCombinedRoles

public void setCombinedRoles(java.util.ArrayList combinedRoles)
Set the combined roles of this user

Parameters:
combinedRoles - combined of the user

getCombinedRoles

public java.util.ArrayList getCombinedRoles()
Get the combined roles of this user

Returns:
the combined of the user

getArrayRoles

public java.lang.String[] getArrayRoles()
Get the roles

Specified by:
getArrayRoles in interface UserMBean
Returns:
the array of the roles

toXML

public java.lang.String toXML()
String representation of the user

Returns:
the xml representation of the user

toString

public java.lang.String toString()
Use the XML representation of this object

Specified by:
toString in interface java.security.Principal
Overrides:
toString in class java.lang.Object
Returns:
the XML representation of this object