public interface OauthClient
OauthClientServletUtil that defines related convenience methods for webapps.BeesClient.getOauthClient()| Modifier and Type | Method and Description |
|---|---|
OauthToken |
createOAuthClientToken(Collection<String> scopes)
OAuth client application can use this method to create an OAuth token with arbitrary scopes
that belongs to the user who registered the application.
|
OauthToken |
createOAuthClientToken(String... scopes)
Overloaded version of
createOAuthClientToken(Collection) |
OauthToken |
createOAuthClientToken(TokenRequest tokenRequest)
Overloaded version of
createOAuthClientToken(Collection) |
OauthToken |
createToken(TokenRequest tokenRequest)
Creates a OAuth token for the current user (used to create
BeesClient) |
void |
deleteApplication(String clientId) |
void |
deleteToken(String oauthTokenId)
Deletes a token created by
createToken(TokenRequest) |
OauthToken |
exchangeToAccessToken(String refreshToken,
String... scopes)
Exchange refresh_token to an access token.
|
OauthToken |
exchangeToAccessToken(String authorizationCode,
String redirectUri)
OAuth client application can use this method to exchange the authorization code
(which it gets from the browser after GC authenticates the user and redirects him back to you)
to the OAuth access token.
|
OauthClientApplication |
getApplication(String clientId)
Gets the details of an OAuth client application by its client ID.
|
List<OauthClientApplication> |
listApplication()
Lists up all the OAuth client applications registered by the current user.
|
List<OauthTokenDetail> |
listTokens()
Lists up all the tokens generated by te current user.
|
String |
parseAuthorizationHeader(String authorizationHeader)
Parses Bearer token from HTTP Authorization header
|
OauthClientApplication |
registerApplication(OauthClientApplication input)
Registers a new OAuth client application.
|
OauthToken |
validateToken(String token)
Obtains the details of the token and performs minimal validation (such as expiration.)
Returns null if the given access token is invalid, otherwise OauthToken is returned.
|
OauthToken |
validateToken(String token,
String... scopes)
Validates token with the given scopes.
|
OauthToken createToken(TokenRequest tokenRequest) throws OauthClientException
BeesClient)OauthClientException - if there is any error during token validationvoid deleteToken(String oauthTokenId) throws OauthClientException
createToken(TokenRequest)OauthClientExceptionAbstractOauthToken.delete()List<OauthTokenDetail> listTokens() throws OauthClientException
OauthClientException@CheckForNull OauthToken validateToken(String token, String... scopes) throws OauthClientException
BeesClient must be constructed with OAuth client ID and client secret as the username and password.
token - non-null tokenscopes - array of scope that are expected to be granted for this tokenOauthClientException@CheckForNull OauthToken validateToken(String token) throws OauthClientException
BeesClient must be constructed with OAuth client ID and client secret as the username and password.
This method call is a network operation. If you are developing a server application that performs frequent token validations, then consider using https://github.com/CloudBees-community/cached-token-validator , which adds caching on top of this.
token - non-null tokenOauthClientExceptionString parseAuthorizationHeader(String authorizationHeader)
authorizationHeader - HTTP Authorization HeaderOauthClientApplication registerApplication(OauthClientApplication input) throws OauthClientException
OauthClientApplication object. This is not the same object
as you passed in the input.OauthClientExceptionOauthClientApplication getApplication(String clientId) throws OauthClientException
OauthClientExceptionList<OauthClientApplication> listApplication() throws OauthClientException
OauthClientExceptionvoid deleteApplication(String clientId) throws OauthClientException
OauthClientExceptionOauthToken exchangeToAccessToken(String authorizationCode, String redirectUri) throws OauthClientException
For this method to work, BeesClient should be called with OAuth client ID and secret.
redirectUri - Required if present in the authorization request, and the value must be the same.OauthClientExceptionOauthToken exchangeToAccessToken(String refreshToken, String... scopes) throws OauthClientException
refreshToken - required. refresh_token.scopes - optional. If not provided the returned access_token carries the same scopes as the one granted
to refresh_token.OauthClientExceptionOauthToken createOAuthClientToken(Collection<String> scopes) throws OauthClientException
For this method to work, BeesClient should be called with OAuth client ID and secret.
OauthClientExceptionOauthToken createOAuthClientToken(String... scopes) throws OauthClientException
createOAuthClientToken(Collection)OauthClientExceptionOauthToken createOAuthClientToken(TokenRequest tokenRequest) throws OauthClientException
createOAuthClientToken(Collection)OauthClientExceptionCopyright © 2011-2015. All Rights Reserved.