Class TokenCredentials
java.lang.Object
org.apache.jackrabbit.api.security.authentication.token.TokenCredentials
- All Implemented Interfaces:
Serializable,Credentials
TokenCredentials implements the Credentials
interface and represents single token credentials. Similar to
SimpleCredentials this credentials implementation allows
to set additional attributes.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable StringgetAttribute(@NotNull String name) Returns the value of the named attribute as anObject, ornullif no attribute of the given name exists.@NotNull String[]Returns the names of the attributes available to this credentials instance.@NotNull StringgetToken()Returns the token this credentials are built from.voidremoveAttribute(@NotNull String name) Removes an attribute from this credentials instance.voidsetAttribute(@NotNull String name, @Nullable String value) Stores an attribute in this credentials instance.
-
Constructor Details
-
TokenCredentials
Create a new instance.- Parameters:
token- A token string used to create this credentials instance.- Throws:
IllegalArgumentException- If the specified token isnullor empty string.
-
-
Method Details
-
getToken
Returns the token this credentials are built from.- Returns:
- the token.
-
setAttribute
Stores an attribute in this credentials instance.- Parameters:
name- aStringspecifying the name of the attributevalue- theObjectto be stored
-
getAttribute
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
Removes an attribute from this credentials instance.- Parameters:
name- aStringspecifying 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
-