public final class TokenCredentials extends Object implements Credentials
TokenCredentials
implements the Credentials
interface and represents single token credentials. Similar to
SimpleCredentials
this credentials implementation allows
to set additional attributes.Constructor and Description |
---|
TokenCredentials(@NotNull String token)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
@Nullable String |
getAttribute(@NotNull String name)
Returns the value of the named attribute as an
Object , or
null 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.
|
public TokenCredentials(@NotNull @NotNull String token) throws IllegalArgumentException
token
- A token string used to create this credentials instance.IllegalArgumentException
- If the specified token is null
or empty string.@NotNull public @NotNull String getToken()
public void setAttribute(@NotNull @NotNull String name, @Nullable @Nullable String value)
name
- a String
specifying the name of the attributevalue
- the Object
to be stored@Nullable public @Nullable String getAttribute(@NotNull @NotNull String name)
Object
, or
null
if no attribute of the given name exists.name
- a String
specifying the name of the attributeObject
containing the value of the attribute, or
null
if the attribute does not existpublic void removeAttribute(@NotNull @NotNull String name)
name
- a String
specifying the name of the attribute to
remove@NotNull public @NotNull String[] getAttributeNames()
Copyright © 2010 - 2020 Adobe. All Rights Reserved