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(String token)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getAttribute(String name)
Returns the value of the named attribute as an
Object, or
null if no attribute of the given name exists. |
String[] |
getAttributeNames()
Returns the names of the attributes available to this credentials
instance.
|
String |
getToken()
Returns the token this credentials are built from.
|
void |
removeAttribute(String name)
Removes an attribute from this credentials instance.
|
void |
setAttribute(String name,
String value)
Stores an attribute in this credentials instance.
|
public TokenCredentials(String token) throws IllegalArgumentException
token - A token string used to create this credentials instance.IllegalArgumentException - If the specified token is null
or empty string.public String getToken()
public void setAttribute(String name, String value)
name - a String specifying the name of the attributevalue - the Object to be storedpublic String getAttribute(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(String name)
name - a String specifying the name of the attribute to
removepublic String[] getAttributeNames()
Copyright © 2004–2021 The Apache Software Foundation. All rights reserved.