com.sap.security.um.user

## Interface User

- All Superinterfaces:
    Principal

      public interface User
      extends Principal

  This interface provides read access to user data and is an extension of `Principal`.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `PasswordCheckResult` | `checkPassword(char[] password)` Deprecated. As of version 1.8, replaced by `UserProvider.checkUserPassword(String, char[])`
    `String` | `getAttribute(String attributeName)` Returns the value of the provided attribute.
    `String[]` | `getAttributeValues(String attributeName)` Returns an array of values for an attribute.
    `Set<String>` | `getGroups()` Returns the groups in which the user is included.
    `Locale` | `getLocale()` Returns the locale of the user or `null`, if no locale is maintained for the user.
    `Set<String>` | `getRoles()` Returns a set of roles assigned to the user.
    `boolean` | `hasRole(String roleName)` Returns whether the user is assigned to the role with the provided name.
    `boolean` | `isValid(Calendar date)` Returns the user's validity at the specified point in time.
    `Set<String>` | `listAttributes()` Returns a set of system-specific aliases of all attributes of this user.

    - ### Methods inherited from interface java.security.Principal

      `equals, getName, hashCode, toString`

- - ### Method Detail

    - #### checkPassword

          PasswordCheckResult checkPassword(char[] password)
                                            throws PersistenceException

      Deprecated. As of version 1.8, replaced by `UserProvider.checkUserPassword(String, char[])`
      Throws:
        `PersistenceException`

    - #### getAttribute

          String getAttribute(String attributeName)
                              throws UnsupportedUserAttributeException

      Returns the value of the provided attribute. If the attribute does not exist or no value is maintained, `null` is returned.
      Parameters:
        `attributeName` - The system-specific alias of the attribute to read.
      Returns:
        The value of the attribute or `null`.
      Throws:
        `UnsupportedUserAttributeException` - If the method is called with the attribute name which is not supported by the user store.

    - #### listAttributes

          Set<String> listAttributes()

      Returns a set of system-specific aliases of all attributes of this user.
      Returns:
        A set of attributes of this user.

    - #### getLocale

          Locale getLocale()

      Returns the locale of the user or `null`, if no locale is maintained for the user.
      Returns:
        The locale or `null`.

    - #### hasRole

          boolean hasRole(String roleName)

      Returns whether the user is assigned to the role with the provided name. The result does not depend on the existence of the role with the specified role name. So this method might return true, if the role is already deleted, but the user is still assigned.
      Parameters:
        `roleName` - The name of the role to check.
      Returns:
        `True` if the user is assigned to the role, otherwise `false`.

    - #### isValid

          boolean isValid(Calendar date)

      Returns the user's validity at the specified point in time. This method is usually used with the current time to check whether the user is allowed to access the system.
      Parameters:
        `date` - The date for which the validity should be checked.
      Returns:
        `True` if the user is valid on the specified point in time, otherwise `false`.

    - #### getRoles

          Set<String> getRoles()

      Returns a set of roles assigned to the user.
      Returns:
        A set of roles assigned to the user.

    - #### getAttributeValues

          String[] getAttributeValues(String attributeName)

      Returns an array of values for an attribute. If it does not exist or no value is maintained, `null` is returned.
      Parameters:
        `attributeName` - The alias of the attribute to read.
      Returns:
        The value of the attribute or `null`.

    - #### getGroups

          Set<String> getGroups()

      Returns the groups in which the user is included.

Copyright © 2020 SAP. All Rights Reserved.