## org.exist.security
Class User

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

public class User
extends java.lang.Object

Represents a user within the database.

Author:
  Wolfgang Meier <wolfgang@exist-db.org>

Field Summary
`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, org.w3c.dom.Element node)` Read a new user from the given DOM node
`User(java.lang.String user)` Create a new user with name
`User(java.lang.String user, java.lang.String password)` Create a new user with name and password
`User(java.lang.String user, java.lang.String password, java.lang.String primaryGroup)` Create a new user with name, password and primary group

Method Summary
`void` `addGroup(java.lang.String group)` Add the user to a group
`java.lang.String` `digest(java.lang.String passwd)`
`boolean` `equals(java.lang.Object obj)`
`java.lang.String` `getDigestPassword()`
`java.lang.String[]` `getGroups()` Get all groups this user belongs to
`XmldbURI` `getHome()`
`java.lang.String` `getName()` Get the user name
`java.lang.String` `getPassword()` Get the user's password
`java.lang.String` `getPrimaryGroup()` Get the primary group this user belongs to
`int` `getUID()`
`boolean` `hasDbaRole()`
`boolean` `hasGroup(java.lang.String group)` Is the user a member of group?
`void` `setEncodedPassword(java.lang.String passwd)` Sets the encoded passwod value of the User object
`void` `setGroups(java.lang.String[] groups)`
`void` `setHome(XmldbURI homeCollection)`
`void` `setPassword(java.lang.String passwd)` Sets the password attribute of the User object
`void` `setPasswordDigest(java.lang.String passwd)` Sets the digest passwod value of the User object
`static void` `setPasswordEncoding(java.lang.String encoding)`
`static void` `setPasswordRealm(java.lang.String value)`
`void` `setUID(int uid)`
`java.lang.String` `toString()`
`boolean` `validate(java.lang.String passwd)`
`boolean` `validateDigest(java.lang.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

Constructor Detail

### User

    public User(java.lang.String user,
                java.lang.String password)

  Create a new user with name and password

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

### User

    public User(java.lang.String user)

  Create a new user with name

Parameters:
  `user` - Description of the Parameter

### User

    public User(java.lang.String user,
                java.lang.String password,
                java.lang.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,
                org.w3c.dom.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

### setPasswordEncoding

    public static void setPasswordEncoding(java.lang.String encoding)

### setPasswordRealm

    public static void setPasswordRealm(java.lang.String value)

### addGroup

    public final void addGroup(java.lang.String group)

  Add the user to a group

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

### setGroups

    public final void setGroups(java.lang.String[] groups)

### getGroups

    public final java.lang.String[] getGroups()

  Get all groups this user belongs to

  Returns:
    The groups value

### hasDbaRole

    public final boolean hasDbaRole()

### getName

    public final java.lang.String getName()

  Get the user name

  Returns:
    The user value

### getUID

    public final int getUID()

### getPassword

    public final java.lang.String getPassword()

  Get the user's password

  Returns:
    Description of the Return Value

### getDigestPassword

    public final java.lang.String getDigestPassword()

### getPrimaryGroup

    public final java.lang.String getPrimaryGroup()

  Get the primary group this user belongs to

  Returns:
    The primaryGroup value

### hasGroup

    public final boolean hasGroup(java.lang.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(java.lang.String passwd)

  Sets the password attribute of the User object

  Parameters:
    `passwd` - The new password value

### setPasswordDigest

    public final void setPasswordDigest(java.lang.String passwd)

  Sets the digest passwod value of the User object

  Parameters:
    `passwd` - The new passwordDigest value

### setEncodedPassword

    public final void setEncodedPassword(java.lang.String passwd)

  Sets the encoded passwod value of the User object

  Parameters:
    `passwd` - The new passwordDigest value

### digest

    public final java.lang.String digest(java.lang.String passwd)

### toString

    public final java.lang.String toString()

### validate

    public final boolean validate(java.lang.String passwd)

### validateDigest

    public final boolean validateDigest(java.lang.String passwd)

### setUID

    public void setUID(int uid)

### setHome

    public void setHome(XmldbURI homeCollection)

### getHome

    public XmldbURI getHome()

### equals

    public boolean equals(java.lang.Object obj)

Copyright (C) Wolfgang Meier. All rights reserved.