org.exist.security
Class User

java.lang.Object
  extended by org.exist.security.User

public class User
extends Object

Represents a user within the database.

Author:
Wolfgang Meier Modified by {Marco.Tampucci, Massimo.Martinelli} @isti.cnr.it

Field Summary
static boolean CHECK_PASSWORDS
           
static User DEFAULT
           
static int MD5_ENCODING
           
static int PASSWORD_ENCODING
           
static int PLAIN_ENCODING
           
static int SIMPLE_MD5_ENCODING
           
 
Constructor Summary
User(int majorVersion, int minorVersion, Element node)
          Read a new user from the given DOM node
User(String user)
          Create a new user with name
User(String user, String password)
          Create a new user with name and password
User(String user, String password, String primaryGroup)
          Create a new user with name, password and primary group
 
Method Summary
 void addGroup(String group)
          Add the user to a group
 String digest(String passwd)
           
static void enablePasswordChecks(boolean check)
           
 boolean equals(Object obj)
           
 String getDigestPassword()
           
 String[] getGroups()
          Get all groups this user belongs to
 XmldbURI getHome()
           
 String getName()
          Get the user name
 String getPassword()
          Get the user's password
 String getPrimaryGroup()
          Get the primary group this user belongs to
 int getUID()
           
 boolean hasDbaRole()
           
 boolean hasGroup(String group)
          Is the user a member of group?
 void remGroup(String group)
          Remove the user to a group Added by {Marco.Tampucci and Massimo.Martinelli}@isti.cnr.it
 void setEncodedPassword(String passwd)
          Sets the encoded passwod value of the User object
 void setGroups(String[] groups)
           
 void setHome(XmldbURI homeCollection)
           
 void setPassword(String passwd)
          Sets the password attribute of the User object
 void setPasswordDigest(String passwd)
          Sets the digest passwod value of the User object
static void setPasswordEncoding(String encoding)
           
static void setPasswordRealm(String value)
           
 void setUID(int uid)
           
 String toString()
           
 boolean validate(String passwd)
          Split up the validate method into two, to make it possible to authenticate users, which are not defined in the instance named "exist" without having impact on the standard functionality.
 boolean validate(String passwd, SecurityManager sm)
           
 boolean validateDigest(String passwd)
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT

public static final User DEFAULT

PLAIN_ENCODING

public static final int PLAIN_ENCODING
See Also:
Constant Field Values

SIMPLE_MD5_ENCODING

public static final int SIMPLE_MD5_ENCODING
See Also:
Constant Field Values

MD5_ENCODING

public static final int MD5_ENCODING
See Also:
Constant Field Values

PASSWORD_ENCODING

public static int PASSWORD_ENCODING

CHECK_PASSWORDS

public static boolean CHECK_PASSWORDS
Constructor Detail

User

public User(String user,
            String password)
Create a new user with name and password

Parameters:
user - Description of the Parameter
password - Description of the Parameter

User

public User(String user)
Create a new user with name

Parameters:
user - Description of the Parameter

User

public User(String user,
            String password,
            String primaryGroup)
Create a new user with name, password and primary group

Parameters:
user - Description of the Parameter
password - Description of the Parameter
primaryGroup - Description of the Parameter

User

public User(int majorVersion,
            int minorVersion,
            Element node)
     throws DatabaseConfigurationException
Read a new user from the given DOM node

Parameters:
node - Description of the Parameter
Throws:
DatabaseConfigurationException - Description of the Exception
Method Detail

enablePasswordChecks

public static void enablePasswordChecks(boolean check)

setPasswordEncoding

public static void setPasswordEncoding(String encoding)

setPasswordRealm

public static void setPasswordRealm(String value)

addGroup

public final void addGroup(String group)
Add the user to a group

Parameters:
group - The feature to be added to the Group attribute

remGroup

public final void remGroup(String group)
Remove the user to a group Added by {Marco.Tampucci and Massimo.Martinelli}@isti.cnr.it

Parameters:
group - The feature to be removed to the Group attribute

setGroups

public final void setGroups(String[] groups)

getGroups

public final String[] getGroups()
Get all groups this user belongs to

Returns:
The groups value

hasDbaRole

public final boolean hasDbaRole()

getName

public final String getName()
Get the user name

Returns:
The user value

getUID

public final int getUID()

getPassword

public final String getPassword()
Get the user's password

Returns:
Description of the Return Value

getDigestPassword

public final String getDigestPassword()

getPrimaryGroup

public final String getPrimaryGroup()
Get the primary group this user belongs to

Returns:
The primaryGroup value

hasGroup

public final boolean hasGroup(String group)
Is the user a member of group?

Parameters:
group - Description of the Parameter
Returns:
Description of the Return Value

setPassword

public final void setPassword(String passwd)
Sets the password attribute of the User object

Parameters:
passwd - The new password value

setPasswordDigest

public final void setPasswordDigest(String passwd)
Sets the digest passwod value of the User object

Parameters:
passwd - The new passwordDigest value

setEncodedPassword

public final void setEncodedPassword(String passwd)
Sets the encoded passwod value of the User object

Parameters:
passwd - The new passwordDigest value

digest

public final String digest(String passwd)

toString

public final String toString()
Overrides:
toString in class Object

validate

public final boolean validate(String passwd)
Split up the validate method into two, to make it possible to authenticate users, which are not defined in the instance named "exist" without having impact on the standard functionality.

Parameters:
passwd -
Returns:
true if the password was correct, false if not, or if there was a problem.

validate

public final boolean validate(String passwd,
                              SecurityManager sm)

validateDigest

public final boolean validateDigest(String passwd)

setUID

public void setUID(int uid)

setHome

public void setHome(XmldbURI homeCollection)

getHome

public XmldbURI getHome()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright (C) Wolfgang Meier. All rights reserved.