Package javax.jcr
Class SimpleCredentials
java.lang.Object
javax.jcr.SimpleCredentials
- All Implemented Interfaces:
Serializable
,Credentials
SimpleCredentials
implements the Credentials
interface and represents simple user ID/password credentials.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleCredentials
(String userID, char[] password) The constructor creates a newSimpleCredentials
object, given a user ID and password. -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute
(String name) Returns the value of the named attribute as anObject
, ornull
if no attribute of the given name exists.String[]
Returns the names of the attributes available to this credentials instance.char[]
Returns the user password.Returns the user ID.void
removeAttribute
(String name) Removes an attribute from this credentials instance.void
setAttribute
(String name, Object value) Stores an attribute in this credentials instance.
-
Constructor Details
-
SimpleCredentials
The constructor creates a newSimpleCredentials
object, given a user ID and password.Note that the given password is cloned before it is stored in the new
SimpleCredentials
object. 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 Details
-
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
Returns the user ID.- Returns:
- the user ID.
-
setAttribute
Stores an attribute in this credentials instance.- Parameters:
name
- aString
specifying the name of the attributevalue
- theObject
to be stored
-
getAttribute
Returns the value of the named attribute as anObject
, ornull
if no attribute of the given name exists.- Parameters:
name
- aString
specifying the name of the attribute- Returns:
- an
Object
containing the value of the attribute, ornull
if the attribute does not exist
-
removeAttribute
Removes an attribute from this credentials instance.- Parameters:
name
- aString
specifying the name of the attribute to remove
-
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
-