OAuthService
Methods Summary
Type | Name | Summary |
---|---|---|
Create a DELETE request.. | ||
Create a GET request for a resource.. | ||
Create a POST request.. | ||
Create a PUT request.. | ||
Creates a JSOAuthRequest for with the enum of RequestType (GET, PUT, DELETE, etc) for a resource url.. | ||
This is quick method by executing a GET request and returning right away the OAuthResponse So it would be the same as executeRequest(createRequest(RequestType.. | ||
Method to execute requests that are made, and configured by #createRequest(Verb,String). | ||
Returns the number of seconds left until the access token expires.. | ||
Get the access token currently set on the service.. | ||
Return the token lifetime in seconds.. | ||
. | ||
Get the authorization url with some additional parameters.. | ||
Obtain the Openid token if it is available.. | ||
Return the refresh token.. | ||
Checks if the access token is expired.. | ||
Obtains a new access token if the OAuth api supports it.. | ||
void | Revoke the provided access token.. | |
void | Configure the oauth service with an access token using the scope that was initially set when creating the service.. | |
void | Configure the oauth service with an access token for the specified scope.. |
Methods Details
createDeleteRequest(resourceURL)
Create a DELETE request.
Parameters String resourceURL the url of the resource to be deleted
Returns OAuthRequest the request object
Sample
createGetRequest(resourceURL)
Create a GET request for a resource.
Parameters String resourceURL the url of the resource which you want to get
Returns OAuthRequest the request object
Sample
createPostRequest(resourceURL)
Create a POST request.
Parameters String resourceURL the url where the enclosed entity will be stored
Returns OAuthRequest the request object
Sample
createPutRequest(resourceURL)
Create a PUT request.
Parameters String resourceURL the url where the enclosed entity will be stored
Returns OAuthRequest the request object
Sample
createRequest(requestType, resourceURL)
Creates a JSOAuthRequest for with the enum of RequestType (GET, PUT, DELETE, etc) for a resource url.
Parameters enum requestType one of the types of plugins.oauth.RequestType String resourceURL the url of the resource you want to access
Returns OAuthRequest a JSOAuthRequest object
Sample
executeGetRequest(resourceURL)
This is quick method by executing a GET request and returning right away the OAuthResponse So it would be the same as executeRequest(createRequest(RequestType.GET, url))
Parameters String resourceURL ;
Returns OAuthResponse the OAuthResponse object
Sample
executeRequest(request)
Method to execute requests that are made, and configured by #createRequest(Verb,String)
Parameters OAuthRequest request the JSOAuthRequest object that was created by #createRequest(Verb,String)
Returns OAuthResponse the OAuthResponse object
Sample
getAccessExpiresIn()
Returns the number of seconds left until the access token expires.
Returns Number seconds left untol the access token expires.
Sample
getAccessToken()
Get the access token currently set on the service.
Returns String the access token or null if it was not set
Sample
getAccessTokenLifetime()
Return the token lifetime in seconds.
Returns Number the token lifetime as it was retrieved by the OAuth provider with the access token
Sample
getAuthorizationURL()
Returns String
Sample
getAuthorizationURL(params)
Get the authorization url with some additional parameters.
Parameters Object params a json containing the parameters and their values e.g. {'param1': 'value1', 'param2': 'value2'}
Returns String the authorization url with the provided parameters appended to the query string.
Sample
getIdToken()
Obtain the Openid token if it is available.
Returns String the id token, or null if was not set on the service.
Sample
getRefreshToken()
Return the refresh token.
Returns String the refresh token or null if it is not present
Sample
isAccessTokenExpired()
Checks if the access token is expired. Returns false if the access token expire information is not set.
Returns Boolean true if the access token is expired, false otherwise
Sample
refreshToken()
Obtains a new access token if the OAuth api supports it.
Returns String The new access token issued by the authorization server
Sample
revokeToken(token)
Revoke the provided access token.
Parameters String token to revoke
Returns void
Sample
setAccessToken(code)
Configure the oauth service with an access token using the scope that was initially set when creating the service.
Parameters String code the authorization code used to request and access token
Returns void
Sample
setAccessToken(code, scope)
Configure the oauth service with an access token for the specified scope.
Parameters String code the authorization code used to request an access token String scope the scope for which to obtain an access token
Returns void
Sample
Last updated