Class TokenCredentials
- java.lang.Object
-
- org.apache.jackrabbit.api.security.authentication.token.TokenCredentials
-
- All Implemented Interfaces:
Serializable
,Credentials
@ProviderType public final class TokenCredentials extends Object implements Credentials
TokenCredentials
implements theCredentials
interface and represents single token credentials. Similar toSimpleCredentials
this credentials implementation allows to set additional attributes.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TokenCredentials(@NotNull String token)
Create a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable String
getAttribute(@NotNull String name)
Returns the value of the named attribute as anObject
, ornull
if no attribute of the given name exists.@NotNull String[]
getAttributeNames()
Returns the names of the attributes available to this credentials instance.@NotNull String
getToken()
Returns the token this credentials are built from.void
removeAttribute(@NotNull String name)
Removes an attribute from this credentials instance.void
setAttribute(@NotNull String name, @Nullable String value)
Stores an attribute in this credentials instance.
-
-
-
Constructor Detail
-
TokenCredentials
public TokenCredentials(@NotNull @NotNull String token) throws IllegalArgumentException
Create a new instance.- Parameters:
token
- A token string used to create this credentials instance.- Throws:
IllegalArgumentException
- If the specified token isnull
or empty string.
-
-
Method Detail
-
getToken
@NotNull public @NotNull String getToken()
Returns the token this credentials are built from.- Returns:
- the token.
-
setAttribute
public void setAttribute(@NotNull @NotNull String name, @Nullable @Nullable String value)
Stores an attribute in this credentials instance.- Parameters:
name
- aString
specifying the name of the attributevalue
- theObject
to be stored
-
getAttribute
@Nullable public @Nullable String getAttribute(@NotNull @NotNull String name)
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
public void removeAttribute(@NotNull @NotNull String name)
Removes an attribute from this credentials instance.- Parameters:
name
- aString
specifying the name of the attribute to remove
-
getAttributeNames
@NotNull public @NotNull 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
-
-