@Exported public class BearerTokenCredentials extends Object implements Credentials.BearerTokenCredentials
Credentials.AppIdClientCredentials, Credentials.BasicCredentials, Credentials.BearerTokenCredentials, Credentials.HeaderCredentials, Credentials.HttpClientCredentials, Credentials.UserNameOnlyCredentials
Constructor and Description |
---|
BearerTokenCredentials(char[] token)
Constructor wrapping a bearer token applicable for all realms with no expiry time
|
BearerTokenCredentials(char[] token,
String realm,
long expiryTime)
Constructor wrapping a bearer token applicable for the specified realm and
value until the specified expiryTime
|
BearerTokenCredentials(String token)
Constructor wrapping a bearer token applicable for all realms with no expiry time
|
Modifier and Type | Method and Description |
---|---|
String |
getCredentialsClassName() |
long |
getExpiryTime() |
String |
getLogId() |
String |
getRealm() |
char[] |
getToken() |
String |
getUserName() |
static String |
maskToken(char[] token) |
void |
setExpiryTime(long expiryTime)
set the expiry time of the token
An expiryTime value less than or equal to 0 indicates the token never expires.
|
void |
setRealm(String realm)
set the realm name to which the token applies (null indicates all realms)
|
void |
setToken(char[] token)
set the bearer token
|
void |
wipeToken()
erase the bearer token
|
public BearerTokenCredentials(String token)
token
- the bearer tokenpublic BearerTokenCredentials(char[] token)
token
- the bearer tokenpublic BearerTokenCredentials(char[] token, String realm, long expiryTime)
token
- the bearer tokenrealm
- the realm to which the token applies (null indicates all realms)expiryTime
- the number of milliseconds post epoch at which point the token expires.
An expiryTime value less than or equal to 0 indicates the token never expires.public char[] getToken()
getToken
in interface Credentials.BearerTokenCredentials
public void setToken(char[] token)
token
- the bearer tokenpublic String getRealm()
getRealm
in interface Credentials.BearerTokenCredentials
public void setRealm(String realm)
realm
- the token's associated realmpublic long getExpiryTime()
getExpiryTime
in interface Credentials.BearerTokenCredentials
public void setExpiryTime(long expiryTime)
expiryTime
- the number of milliseconds post epoch at which point the token expires.public void wipeToken()
public String getUserName()
getUserName
in interface Credentials
public String getCredentialsClassName()
getCredentialsClassName
in interface Credentials
public String getLogId()
getLogId
in interface Credentials
public static String maskToken(char[] token)