Package javax.jcr
Class SimpleCredentials
- java.lang.Object
-
- javax.jcr.SimpleCredentials
-
- All Implemented Interfaces:
java.io.Serializable,Credentials
public final class SimpleCredentials extends java.lang.Object implements Credentials
SimpleCredentialsimplements theCredentialsinterface and represents simple user ID/password credentials.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SimpleCredentials(java.lang.String userID, char[] password)The constructor creates a newSimpleCredentialsobject, given a user ID and password.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectgetAttribute(java.lang.String name)Returns the value of the named attribute as anObject, ornullif no attribute of the given name exists.java.lang.String[]getAttributeNames()Returns the names of the attributes available to this credentials instance.char[]getPassword()Returns the user password.java.lang.StringgetUserID()Returns the user ID.voidremoveAttribute(java.lang.String name)Removes an attribute from this credentials instance.voidsetAttribute(java.lang.String name, java.lang.Object value)Stores an attribute in this credentials instance.
-
-
-
Constructor Detail
-
SimpleCredentials
public SimpleCredentials(java.lang.String userID, char[] password)The constructor creates a newSimpleCredentialsobject, given a user ID and password.Note that the given password is cloned before it is stored in the new
SimpleCredentialsobject. This should avoid the risk of having unnecessary references to password data lying around in memory.- Parameters:
userID- the user IDpassword- the user's password
-
-
Method Detail
-
getPassword
public char[] getPassword()
Returns the user password.Note that this method returns a reference to the password. It is the caller's responsibility to zero out the password information after it is no longer needed.
- Returns:
- the password
-
getUserID
public java.lang.String getUserID()
Returns the user ID.- Returns:
- the user ID.
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object value)Stores an attribute in this credentials instance.- Parameters:
name- aStringspecifying the name of the attributevalue- theObjectto be stored
-
getAttribute
public java.lang.Object getAttribute(java.lang.String name)
Returns the value of the named attribute as anObject, ornullif no attribute of the given name exists.- Parameters:
name- aStringspecifying the name of the attribute- Returns:
- an
Objectcontaining the value of the attribute, ornullif the attribute does not exist
-
removeAttribute
public void removeAttribute(java.lang.String name)
Removes an attribute from this credentials instance.- Parameters:
name- aStringspecifying the name of the attribute to remove
-
getAttributeNames
public java.lang.String[] getAttributeNames()
Returns the names of the attributes available to this credentials instance. This method returns an empty array if the credentials instance has no attributes available to it.- Returns:
- a string array containing the names of the stored attributes
-
-