Package com.sas.services.user

# Class SimpleUserIdentity

java.lang.Object
com.sas.services.user.SimpleUserIdentity

All Implemented Interfaces:
  `ConsumedResourceInterface`, `UserIdentityInterface`, `Serializable`, `Cloneable`

public class SimpleUserIdentity extends Object implements UserIdentityInterface, Serializable, Cloneable, ConsumedResourceInterface
The SimpleUserIdentity class implements a simple user/password identity.

Since:
  1.0
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SimpleUserIdentity()`
  Constructs a default instance.
  `SimpleUserIdentity(boolean isPrimary)`
  Constructs an identity which may be designated as a primary.
  `SimpleUserIdentity(String principal, String credential, String domain)`
  Construct new identity given the principal, credential, and domain strings.
  `SimpleUserIdentity(String principal, String credential, String domain, boolean isPrimary)`
  Constructs an identity for the specified principal, credential, domain.
  `SimpleUserIdentity(String uid, String principal, String credential, String domain)`
  Construct new identity given the unique ID, principal, credential, and domain strings.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final Object`
  `clone()`
  Creates a clone of this object by copying the values for each of its attributes.
  `boolean`
  `equals(Object object)`
  Compare against another object for equality.
  `Object`
  `getCredential()`
  Get the credential for this identity.
  `String`
  `getDomain()`
  Get the string identifying the domain this identity applies to.
  `String`
  `getLocalizedResourceType()`
  Gets a localized value describing the resource's type.
  `String`
  `getLocalizedResourceTypeAndValue()`
  Gets a localized value describing the resource's type and value.
  `String`
  `getMechanism()`
  Get the authentication mechanism for this identity.
  `Object`
  `getPrincipal()`
  Get the principal.
  `String`
  `getResolvedUserName()`
  Get the user name that was resolved by the authentication server.
  `String`
  `getResourceID()`
  Gets the id that uniquely identifies the resource within a service's configuration.
  `String`
  `getResourceType()`
  Gets a value describing the resource's type.
  `int`
  `getResourceTypeCode()`
  Gets the code describing the resource's type.
  `String`
  `getResourceValue()`
  Gets the value used to identify the service configuration resource.
  `Object`
  `getUserIdentity()`
  Deprecated.
  Use getPrincipal instead.
  `final boolean`
  `hasConflict(SimpleUserIdentity other)`
  Indicates whether some other object conflicts with this one.
  `int`
  `hashCode()`
  Gets the hash code.
  `boolean`
  `isAuthenticated()`
  Return a flag indicating whether this identity has been authenticated or not.
  `boolean`
  `isPrimary()`
  Return a flag indicating if this is the primary authentication credential set.
  `boolean`
  `isRequired()`
  Determines if this resource is required by the service's configuration.
  `boolean`
  `isSticky()`
  `void`
  `setAuthenticated(boolean value)`
  Set the flag indicating this identity has been authenticated.
  `void`
  `setCredential(Object credential)`
  Set the credential for this identity.
  `void`
  `setDomain(String domain)`
  Set the domain string for this identity.
  `void`
  `setPrincipal(Object principal)`
  Set the principal to use for authentication.
  `void`
  `setResolvedUserName(String resolvedUserName)`
  Set the resolved username.
  `void`
  `setSticky(boolean sticky)`
  `void`
  `setUserIdentity(Object identity)`
  Deprecated.
  This adds no information above and beyond the principal.
  `String`
  `toString()`
  Gets a string representation of this user identity.

  ### Methods inherited from class java.lang.Object

  `finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### SimpleUserIdentity

    public SimpleUserIdentity()
    Constructs a default instance.

  - ### SimpleUserIdentity

    public SimpleUserIdentity(boolean isPrimary)
    Constructs an identity which may be designated as a primary.
    Parameters:
      `isPrimary` - Primary identity.

  - ### SimpleUserIdentity

    public SimpleUserIdentity(String principal, String credential, String domain)
    Construct new identity given the principal, credential, and domain strings.
    Parameters:
      `principal` - User principal
      `credential` - User's credential
      `domain` - User's authentication domain.

  - ### SimpleUserIdentity

    public SimpleUserIdentity(String uid, String principal, String credential, String domain)
    Construct new identity given the unique ID, principal, credential, and domain strings.
    Parameters:
      `uid` - Unique identifier.
      `principal` - User principal
      `credential` - User's credential
      `domain` - User's authentication domain.

  - ### SimpleUserIdentity

    public SimpleUserIdentity(String principal, String credential, String domain, boolean isPrimary)
    Constructs an identity for the specified principal, credential, domain.
    Parameters:
      `principal` - Principal
      `credential` - Credential
      `domain` - Domain
      `isPrimary` - Whether or not the identity is the primary.

- ## Method Details

  - ### isAuthenticated

    public boolean isAuthenticated()
    Return a flag indicating whether this identity has been authenticated or not.

    Specified by:
      `isAuthenticated` in interface `UserIdentityInterface`
    Returns:
      true if it has been authenticated, false otherwise.

  - ### setAuthenticated

    public void setAuthenticated(boolean value)
    Set the flag indicating this identity has been authenticated.

    Specified by:
      `setAuthenticated` in interface `UserIdentityInterface`
    Parameters:
      `value` - A true/false indicator of authentication.

  - ### getDomain

    public String getDomain()
    Get the string identifying the domain this identity applies to.

    Specified by:
      `getDomain` in interface `UserIdentityInterface`
    Returns:
      The domain string.

  - ### setDomain

    public void setDomain(String domain)
    Set the domain string for this identity. This represents a security domain within which this principal and credential are valid.

    Specified by:
      `setDomain` in interface `UserIdentityInterface`
    Parameters:
      `domain` - The String that denotes the domain for this identity.

  - ### setPrincipal

    public void setPrincipal(Object principal)
    Set the principal to use for authentication. This is the user id or user name for this user in this security domain.

    Specified by:
      `setPrincipal` in interface `UserIdentityInterface`
    Parameters:
      `principal` - The principal to use to authenticate this user.

  - ### getPrincipal

    public Object getPrincipal()
    Get the principal. For this class, the principal will be a String.

    Specified by:
      `getPrincipal` in interface `UserIdentityInterface`
    Returns:
      The principal string for this user in this domain.

  - ### setCredential

    public void setCredential(Object credential)
    Set the credential for this identity. For this class, the credential should be a password String.

    Specified by:
      `setCredential` in interface `UserIdentityInterface`
    Parameters:
      `credential` - A credential for this identity.

  - ### getCredential

    public Object getCredential()
    Get the credential for this identity. If a client already has a handle to this identity, there's nothing to stop them from getting the credential. I'm counting on the UserContext to stop them from getting a handle to the identity if they're not supposed to have it.

    Specified by:
      `getCredential` in interface `UserIdentityInterface`
    Returns:
      The credential.

  - ### getMechanism

    public String getMechanism()
    Get the authentication mechanism for this identity.
    Specified by:
      `getMechanism` in interface `UserIdentityInterface`
    Returns:
      Identity's authentication mechanism "simple".

  - ### getUserIdentity

    public Object getUserIdentity()
    Deprecated.
    Use getPrincipal instead.
    Get the authenticated identity for this user. The authenticated identity might be different from the principal.

    Specified by:
      `getUserIdentity` in interface `UserIdentityInterface`
    Returns:
      An object that represents the authenticated identity.

  - ### setUserIdentity

    public void setUserIdentity(Object identity)
    Deprecated.
    This adds no information above and beyond the principal.
    Set the authenticated identity for the user. This should only be set by the authentication mechanism.

    Specified by:
      `setUserIdentity` in interface `UserIdentityInterface`
    Parameters:
      `identity` - The new authenticated identity for the user in this domain.

  - ### equals

    public boolean equals(Object object)
    Compare against another object for equality.

    Specified by:
      `equals` in interface `UserIdentityInterface`
    Overrides:
      `equals` in class `Object`
    Parameters:
      `object` - The object to compare against
    Returns:
      true if the objects are equal, false otherwise

  - ### hashCode

    public int hashCode()
    Gets the hash code.
    Overrides:
      `hashCode` in class `Object`
    Returns:
      Hash code.

  - ### clone

    public final Object clone()
    Creates a clone of this object by copying the values for each of its attributes.
    Specified by:
      `clone` in interface `ConsumedResourceInterface`
    Overrides:
      `clone` in class `Object`
    Returns:
      Clone of this object.

  - ### isPrimary

    public boolean isPrimary()
    Description copied from interface: `UserIdentityInterface`
    Return a flag indicating if this is the primary authentication credential set.
    Specified by:
      `isPrimary` in interface `UserIdentityInterface`
    Returns:
      true if this identity was used for the primary authentication. False otherwise.

  - ### toString

    public String toString()
    Gets a string representation of this user identity. The following values are summarized.
    - principal
    - domain
    Overrides:
      `toString` in class `Object`

  - ### setResolvedUserName

    public void setResolvedUserName(String resolvedUserName)
    Set the resolved username. This is the name the authenticating server resolved the username to, which may be domain qualified.
    Parameters:
      `resolvedUserName` - The new resolved username.

  - ### getResolvedUserName

    public String getResolvedUserName()
    Description copied from interface: `UserIdentityInterface`
    Get the user name that was resolved by the authentication server. This will only be set on a primary identity, and only if the user is defined in the metadata (i.e., not a "public" user). This string will be of the form user@domain for Windows domains, and just user for non-Windows platforms. This string should be consistent regardless of whether the user logged in with username, domain\\username or username@domain.
    Specified by:
      `getResolvedUserName` in interface `UserIdentityInterface`
    Returns:
      The domain-qualified user name as resolved by the authenticating server, or null if the user could not be resolved.

  - ### hasConflict

    public final boolean hasConflict(SimpleUserIdentity other)
    Indicates whether some other object conflicts with this one. The other object is equivalent if all of the following are equivalent:
    - is authenticated
    - resolved user name
    - credential
    - is primary
    - domain
    - principal
    Parameters:
      `other` - The other identity.
    Returns:
      `true` if this object conflicts with the other identity or `false` otherwise.

  - ### getResourceID

    public String getResourceID()
    Description copied from interface: `ConsumedResourceInterface`
    Gets the id that uniquely identifies the resource within a service's configuration.
    Specified by:
      `getResourceID` in interface `ConsumedResourceInterface`
    Returns:
      Resource's ID.

  - ### getResourceValue

    public String getResourceValue()
    Description copied from interface: `ConsumedResourceInterface`
    Gets the value used to identify the service configuration resource.
    Specified by:
      `getResourceValue` in interface `ConsumedResourceInterface`
    Returns:
      Service configuration resource's value.

  - ### getLocalizedResourceType

    public String getLocalizedResourceType()
    Description copied from interface: `ConsumedResourceInterface`
    Gets a localized value describing the resource's type.
    Specified by:
      `getLocalizedResourceType` in interface `ConsumedResourceInterface`
    Returns:
      Resource's type. For example, a Logging Service configuration's resource types would be localized values for "Context", "Output", and "Renderer".

  - ### getLocalizedResourceTypeAndValue

    public String getLocalizedResourceTypeAndValue()
    Description copied from interface: `ConsumedResourceInterface`
    Gets a localized value describing the resource's type and value.
    Specified by:
      `getLocalizedResourceTypeAndValue` in interface `ConsumedResourceInterface`
    Returns:
      Resource's type. For example, a Logging Service configuration's resource types would be localized values for
      - "Context : com.sas.services"
      - "Output : A1"
      - "Renderer: com.sas.MyRenderer"

  - ### getResourceType

    public String getResourceType()
    Description copied from interface: `ConsumedResourceInterface`
    Gets a value describing the resource's type.
    Specified by:
      `getResourceType` in interface `ConsumedResourceInterface`
    Returns:
      Resource's type. For example, a Logging Service configuration's resource types would be "Context", "Output", and "Renderer".

  - ### getResourceTypeCode

    public int getResourceTypeCode()
    Description copied from interface: `ConsumedResourceInterface`
    Gets the code describing the resource's type.
    Specified by:
      `getResourceTypeCode` in interface `ConsumedResourceInterface`
    Returns:
      Resource's type code.

  - ### isRequired

    public boolean isRequired()
    Description copied from interface: `ConsumedResourceInterface`
    Determines if this resource is required by the service's configuration.
    Specified by:
      `isRequired` in interface `ConsumedResourceInterface`
    Returns:
      `true` if this resource is required by the service's configuration.

  - ### isSticky

    public boolean isSticky()

  - ### setSticky

    public void setSticky(boolean sticky)