public class TokenRequest extends Object
OauthClient.createToken(TokenRequest) call.| Constructor and Description |
|---|
TokenRequest() |
TokenRequest(String note,
String noteUrl,
String refreshToken,
String accountName,
String... scopes)
Create a Json serializable Oauth token request.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getAccessType() |
String |
getAccountName() |
String |
getNote() |
String |
getNoteUrl() |
String |
getRefreshToken() |
List<String> |
getScopes() |
String |
toString()
For assisting debugging.
|
TokenRequest |
withAccountName(String accountName)
Sets the account name that the generated token is restricted to.
|
TokenRequest |
withGenerateRequestToken(boolean b)
Request that the refresh token be generated aside from access token.
|
TokenRequest |
withNote(String note) |
TokenRequest |
withNote(String note,
String noteUrl) |
TokenRequest |
withRefreshToken(String refreshToken)
Instead of authenticating the create token request
with the parameters you set in
BeesClientConfiguration (such as API key + secret, or username + password),
authenticate the call with the specified refresh token generated earlier. |
TokenRequest |
withScope(CloudResource res,
Capability capability) |
TokenRequest |
withScope(String scope)
Adds more scopes to this request.
|
TokenRequest |
withScope(URL cloudResource,
Capability capability) |
TokenRequest |
withScopes(String... scopes) |
public TokenRequest(String note, String noteUrl, String refreshToken, String accountName, String... scopes)
note - optional. Tells something about the oauth applicationnoteUrl - optional. Your application URLrefreshToken - optional. Refresh token that should be used to generate a new token.accountName - required. Name of the accountscopes - Optional. array of scopes to be granted with this token. The default scope is https://api.cloudbees.com/v2/users/user,
which is user read and write scope. If you are creating token to crete other tokens with specific scopes you must ask for
https://api.cloudbees.com/v2/users/user/generate_token scope scope.IllegalArgumentException - In case there is an errorpublic TokenRequest()
public String getNote()
public String getNoteUrl()
public TokenRequest withNote(String note)
public TokenRequest withNote(String note, String noteUrl)
note - One liner human readable text describing who requested this token. This will
aid users in reviewing and revoking tokens later. Can be null.noteUrl - URL that provides more details about the note. Can be null.public TokenRequest withScope(String scope)
public TokenRequest withScopes(String... scopes)
public TokenRequest withScope(CloudResource res, Capability capability)
public TokenRequest withScope(URL cloudResource, Capability capability)
public String getRefreshToken()
public TokenRequest withRefreshToken(String refreshToken)
BeesClientConfiguration (such as API key + secret, or username + password),
authenticate the call with the specified refresh token generated earlier.public String getAccountName()
public TokenRequest withAccountName(String accountName)
public String getAccessType()
public TokenRequest withGenerateRequestToken(boolean b)
withRefreshToken(String)Copyright © 2011-2015. All Rights Reserved.