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:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs 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 TypeMethodDescriptionfinal Objectclone()Creates a clone of this object by copying the values for each of its attributes.booleanequals(Object object) Compare against another object for equality.ObjectGet the credential for this identity.StringGet the string identifying the domain this identity applies to.StringGets a localized value describing the resource's type.StringGets a localized value describing the resource's type and value.StringGet the authentication mechanism for this identity.ObjectGet the principal.StringGet the user name that was resolved by the authentication server.StringGets the id that uniquely identifies the resource within a service's configuration.StringGets a value describing the resource's type.intGets the code describing the resource's type.StringGets the value used to identify the service configuration resource.ObjectDeprecated.Use getPrincipal instead.final booleanhasConflict(SimpleUserIdentity other) Indicates whether some other object conflicts with this one.inthashCode()Gets the hash code.booleanReturn a flag indicating whether this identity has been authenticated or not.booleanReturn a flag indicating if this is the primary authentication credential set.booleanDetermines if this resource is required by the service's configuration.booleanisSticky()voidsetAuthenticated(boolean value) Set the flag indicating this identity has been authenticated.voidsetCredential(Object credential) Set the credential for this identity.voidsetDomain(String domain) Set the domain string for this identity.voidsetPrincipal(Object principal) Set the principal to use for authentication.voidsetResolvedUserName(String resolvedUserName) Set the resolved username.voidsetSticky(boolean sticky) voidsetUserIdentity(Object identity) Deprecated.This adds no information above and beyond the principal.StringtoString()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 principalcredential- User's credentialdomain- 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 principalcredential- User's credentialdomain- 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- Principalcredential- Credentialdomain- DomainisPrimary- 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:
isAuthenticatedin interfaceUserIdentityInterface- 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:
setAuthenticatedin interfaceUserIdentityInterface- Parameters:
value- A true/false indicator of authentication.
-
getDomain
public String getDomain()Get the string identifying the domain this identity applies to.- Specified by:
getDomainin interfaceUserIdentityInterface- 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:
setDomainin interfaceUserIdentityInterface- 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:
setPrincipalin interfaceUserIdentityInterface- 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:
getPrincipalin interfaceUserIdentityInterface- 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:
setCredentialin interfaceUserIdentityInterface- 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:
getCredentialin interfaceUserIdentityInterface- Returns:
- The credential.
-
getMechanism
public String getMechanism()Get the authentication mechanism for this identity.- Specified by:
getMechanismin interfaceUserIdentityInterface- 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:
getUserIdentityin interfaceUserIdentityInterface- 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:
setUserIdentityin interfaceUserIdentityInterface- 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:
equalsin interfaceUserIdentityInterface- Overrides:
equalsin classObject- 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:
hashCodein classObject- 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:
clonein interfaceConsumedResourceInterface- Overrides:
clonein classObject- Returns:
- Clone of this object.
-
isPrimary
public boolean isPrimary()Description copied from interface:UserIdentityInterfaceReturn a flag indicating if this is the primary authentication credential set.- Specified by:
isPrimaryin interfaceUserIdentityInterface- 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:
toStringin classObject
-
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:UserIdentityInterfaceGet 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:
getResolvedUserNamein interfaceUserIdentityInterface- Returns:
- The domain-qualified user name as resolved by the authenticating server, or null if the user could not be resolved.
-
hasConflict
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:
trueif this object conflicts with the other identity orfalseotherwise.
-
getResourceID
public String getResourceID()Description copied from interface:ConsumedResourceInterfaceGets the id that uniquely identifies the resource within a service's configuration.- Specified by:
getResourceIDin interfaceConsumedResourceInterface- Returns:
- Resource's ID.
-
getResourceValue
public String getResourceValue()Description copied from interface:ConsumedResourceInterfaceGets the value used to identify the service configuration resource.- Specified by:
getResourceValuein interfaceConsumedResourceInterface- Returns:
- Service configuration resource's value.
-
getLocalizedResourceType
public String getLocalizedResourceType()Description copied from interface:ConsumedResourceInterfaceGets a localized value describing the resource's type.- Specified by:
getLocalizedResourceTypein interfaceConsumedResourceInterface- 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:ConsumedResourceInterfaceGets a localized value describing the resource's type and value.- Specified by:
getLocalizedResourceTypeAndValuein interfaceConsumedResourceInterface- 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:ConsumedResourceInterfaceGets a value describing the resource's type.- Specified by:
getResourceTypein interfaceConsumedResourceInterface- 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:ConsumedResourceInterfaceGets the code describing the resource's type.- Specified by:
getResourceTypeCodein interfaceConsumedResourceInterface- Returns:
- Resource's type code.
-
isRequired
public boolean isRequired()Description copied from interface:ConsumedResourceInterfaceDetermines if this resource is required by the service's configuration.- Specified by:
isRequiredin interfaceConsumedResourceInterface- Returns:
trueif this resource is required by the service's configuration.
-
isSticky
public boolean isSticky() -
setSticky
public void setSticky(boolean sticky)
-