Nitido Inc.

com.nitido.nim
Class Credential

java.lang.Object
  extended by com.nitido.nim.Credential
All Implemented Interfaces:
java.io.Serializable

public final class Credential
extends java.lang.Object
implements java.io.Serializable

The Credential class is data container of credential information for entities. This object is designed to store the credential data information only. It should NEVER be used as a KEY object in data containers (such as Hashtable, HashMap or HashSet). It is because its hashCode() method is not overrided and it will return the default hashCode, which depends on the instance ID only.

See Also:
CredentialConstants, Serialized Form

Constructor Summary
Credential(Credential inCred)
          Copy constructor of the credential.
Credential(java.lang.String idGroup, java.lang.String entityId)
          This constructor is used to create a new instance of a Credential object.
 
Method Summary
 java.lang.Object clone()
          Clones ths credential.
 boolean equals(java.lang.Object obj)
          This method returns true if the given object is a credential with the same tokens as this credential.
 java.lang.String getEntityId()
          This method returns the entity identifier for this credential.
 java.lang.String getIdentifyingGroup()
          This method returns the identifying group of the credential.
 java.io.Serializable getToken(java.lang.String key)
          This method returns the authentication token associated with the given key.
 java.util.Enumeration getTokenKeys()
          This method returns an enumeration with all the token keys currently associated to this credential.
 boolean isAuthenticated()
          This method returns true if the credential has been authenticated, otherwise this method returns false.
protected  void setAuthenticated(boolean authFlag)
          This PROTECTED method is used by the nim core to set the authenticated flag.
 void setToken(java.lang.String key, java.io.Serializable value)
          This methods is used to add an authentication token to this credential.
 java.lang.String toString()
          This method returns the string representation of this credential.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Credential

public Credential(java.lang.String idGroup,
                  java.lang.String entityId)
           throws NiMRuntimeException
This constructor is used to create a new instance of a Credential object.

Parameters:
idGroup - The String that specified the type of the entity this credential represents. The actual semantics and format of the idGroup String depends on the underlying implementation of entity or entitlement services.
entityId - The string identifier of the entity this credential represents.
Throws:
NiMRuntimeException - If any of the given parameters are null.

Credential

public Credential(Credential inCred)
Copy constructor of the credential.

For example:
You have a Credential A that has a token X that is a Vector. Now, you create Credential B with this constructor and with Credential A as parameter. Credential B will have a reference to the token X. If you add another token Y to Credential B, Credential A will not be affected at all. However, if you add another element to the vector referenced by token X, Credential A may be affected since its token X value has a reference to the same vector.

Method Detail

setToken

public final void setToken(java.lang.String key,
                           java.io.Serializable value)
                    throws java.lang.IllegalStateException
This methods is used to add an authentication token to this credential.

A token is a piece of information that can be used to authenticate the credential, for example, the password of a user.

Parameters:
key - The key used to associate the given token.
value - The value of the authentication token. To remove the value associated to a key, you can pass null object for this parameter.
Throws:
java.lang.IllegalStateException - if the credential has been authenticated already (no token change is allowed on an authenticated credential).

getToken

public final java.io.Serializable getToken(java.lang.String key)
This method returns the authentication token associated with the given key.

Parameters:
key - The key of the requested token.
Returns:
The authentication token associated to the given key. If the key is not found, this method will return null.

getTokenKeys

public final java.util.Enumeration getTokenKeys()
This method returns an enumeration with all the token keys currently associated to this credential.

Returns:
An enumeration with all the token keys currently associated to this credential. If no tokens are associated to the credential, the method returns an empty enumeration.

getIdentifyingGroup

public final java.lang.String getIdentifyingGroup()
This method returns the identifying group of the credential.

Returns:
The identifying group for this credential.

getEntityId

public final java.lang.String getEntityId()
This method returns the entity identifier for this credential.

Returns:
The entity identifier for this credential.

isAuthenticated

public final boolean isAuthenticated()
This method returns true if the credential has been authenticated, otherwise this method returns false.

Returns:
true if the credential has been authenticated, otherwise false..

setAuthenticated

protected final void setAuthenticated(boolean authFlag)
This PROTECTED method is used by the nim core to set the authenticated flag.

Parameters:
authFlag - If the given flag is true, the credential is marked as authenticated, otherwise the credential is not considered to be authenticated.

toString

public final java.lang.String toString()
This method returns the string representation of this credential.

Overrides:
toString in class java.lang.Object
Returns:
The string representation of this credential.

equals

public final boolean equals(java.lang.Object obj)
This method returns true if the given object is a credential with the same tokens as this credential.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The object used to compared this credential with.
Returns:
true if the given object is the same as this credential otherwise false.

clone

public java.lang.Object clone()
Clones ths credential. This method overrides the default clone() implementation of java.lang.Object.

Overrides:
clone in class java.lang.Object
Returns:
another instance of Credential that contains a copy of the data for this credential.

Nitido NiM 2.5 Java API

These JavaDoc pages are generated for release/nim_2_5-2.5.44

Copyright © 1999-2009 Nitido Inc.    Proprietary and Confidential.    All Rights Reserved.