com.sas.services.user
Class SimpleUserIdentity

com.sas.services.user.SimpleUserIdentity
All Implemented Interfaces:
ConsumedResourceInterface, UserIdentityInterface, java.io.Serializable, java.lang.Cloneable

public class SimpleUserIdentity
implements UserIdentityInterface, java.io.Serializable, java.lang.Cloneable, ConsumedResourceInterface

The SimpleUserIdentity class implements a simple user/password identity.

Since:
1.0
See Also:
Serialized Form

Constructor Summary
SimpleUserIdentity()
          Constructs a default instance.
SimpleUserIdentity(boolean isPrimary)
          Constructs an identity which may be designated as a primary.
SimpleUserIdentity(java.lang.String principal, java.lang.String credential, java.lang.String domain)
          Construct new identity given the principal, credential, and domain strings.
SimpleUserIdentity(java.lang.String principal, java.lang.String credential, java.lang.String domain, boolean isPrimary)
          Constructs an identity for the specified principal, credential, domain.
SimpleUserIdentity(java.lang.String uid, java.lang.String principal, java.lang.String credential, java.lang.String domain)
          Construct new identity given the unique ID, principal, credential, and domain strings.
 
Method Summary
 java.lang.Object clone()
          Creates a clone of this object by copying the values for each of its attributes.
 boolean equals(java.lang.Object object)
          Compare against another object for equality.
 java.lang.Object getCredential()
          Get the credential for this identity.
 java.lang.String getDomain()
          Get the string identifying the domain this identity applies to.
 java.lang.String getLocalizedResourceType()
          Gets a localized value describing the resource's type.
 java.lang.String getLocalizedResourceTypeAndValue()
          Gets a localized value describing the resource's type and value.
 java.lang.String getMechanism()
          Get the authentication mechanism for this identity.
 java.lang.Object getPrincipal()
          Get the principal.
 java.lang.String getResolvedUserName()
          Get the user name that was resolved by the authentication server.
 java.lang.String getResourceID()
          Gets the id that uniquely identifies the resource within a service's configuration.
 java.lang.String getResourceType()
          Gets a value describing the resource's type.
 int getResourceTypeCode()
          Gets the code describing the resource's type.
 java.lang.String getResourceValue()
          Gets the value used to identify the service configuration resource.
 java.lang.Object getUserIdentity()
          Deprecated. Use getPrincipal instead.
 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(java.lang.Object credential)
          Set the credential for this identity.
 void setDomain(java.lang.String domain)
          Set the domain string for this identity.
 void setPrincipal(java.lang.Object principal)
          Set the principal to use for authentication.
 void setResolvedUserName(java.lang.String resolvedUserName)
          Set the resolved username.
 void setSticky(boolean sticky)
           
 void setUserIdentity(java.lang.Object identity)
          Deprecated. This adds no information above and beyond the principal.
 java.lang.String toString()
          Gets a string representation of this user identity.
 

Constructor Detail

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(java.lang.String principal,
                          java.lang.String credential,
                          java.lang.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(java.lang.String uid,
                          java.lang.String principal,
                          java.lang.String credential,
                          java.lang.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(java.lang.String principal,
                          java.lang.String credential,
                          java.lang.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 Detail

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 java.lang.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(java.lang.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(java.lang.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 java.lang.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(java.lang.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 java.lang.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 java.lang.String getMechanism()
Get the authentication mechanism for this identity.

Specified by:
getMechanism in interface UserIdentityInterface
Returns:
Identity's authentication mechanism "simple".

getUserIdentity

public java.lang.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(java.lang.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(java.lang.Object object)
Compare against another object for equality.

Specified by:
equals in interface UserIdentityInterface
Overrides:
equals in class java.lang.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 java.lang.Object
Returns:
Hash code.

clone

public final java.lang.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 java.lang.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 java.lang.String toString()
Gets a string representation of this user identity. The following values are summarized.

Overrides:
toString in class java.lang.Object

setResolvedUserName

public void setResolvedUserName(java.lang.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 java.lang.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:

Parameters:
other - The other identity.
Returns:
true if this object conflicts with the other identity or false otherwise.

getResourceID

public java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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)



Copyright © 2009 SAS Institute Inc. All Rights Reserved.