public class OauthToken extends AbstractOauthToken implements Cloneable
| Modifier and Type | Field and Description |
|---|---|
String |
accessToken
A short-lived opaque token that you'll send in the "Authorize" HTTP header as "Authorize: bearer valueOfAccessToken"
|
String |
clientId |
String |
refreshToken
Refresh token lasts for a long time and can be used to obtain additional
accessTokens. |
String |
scope
White-space separated OAuth scopes of this token.
|
String |
tokenType |
email, id, uid, userAccountRoleowner| Constructor and Description |
|---|
OauthToken() |
| Modifier and Type | Method and Description |
|---|---|
Credential |
asCredential()
Uses this OAuth token as a
Credential object. |
boolean |
belongsToAccount(String account)
Checks if this token grants access to the specified account.
|
OauthToken |
clone() |
BeesClient |
createClient()
Creates a new
BeesClient that uses the access token encapsulated in this OauthToken |
BeesClient |
createClient(com.cloudbees.api.BeesClientConfiguration current)
Creates a new
BeesClient that uses the access token encapsulated in this OauthToken. |
Integer |
getExpiresIn()
The number of seconds the access token will be valid, relative to the point of time where
the call is issued to obtain this object (such as via
OauthClient.validateToken(String, String...). |
List<String> |
getScopes()
OAuth scopes of this token split by the whitespace.
|
boolean |
isExpired() |
Collection<String> |
listAccounts()
List up all the accounts to which this token grants some access.
|
void |
setAccount(String account) |
void |
setExpiresIn(int expiresIn) |
boolean |
validateCapability(URL host,
Capability cap)
Checks if this token has a scope that matches the given domain name and capability.
|
boolean |
validateScope(String scope)
Return true if the given scope is fond in the scopes granted with this token
|
boolean |
validateScopes(String... scopes)
Checks if this token has any of the scopes specified
|
deletepublic String accessToken
public String refreshToken
accessTokens.public String tokenType
public String clientId
public String scope
@CheckReturnValue public boolean validateScope(String scope)
@CheckReturnValue public boolean validateScopes(String... scopes)
@CheckReturnValue public boolean validateCapability(URL host, Capability cap)
host - Represents the endpoint.public boolean belongsToAccount(String account)
public Collection<String> listAccounts()
public void setAccount(String account)
public Integer getExpiresIn()
OauthClient.validateToken(String, String...).
0 or less means the token has already expired.public void setExpiresIn(int expiresIn)
public boolean isExpired()
public OauthToken clone()
public BeesClient createClient()
BeesClient that uses the access token encapsulated in this OauthTokenpublic BeesClient createClient(com.cloudbees.api.BeesClientConfiguration current)
BeesClient that uses the access token encapsulated in this OauthToken.current - The configuration parameter to inherit from. This method does not mutate this object.public Credential asCredential()
Credential object.Copyright © 2011-2015. All Rights Reserved.