Interface OAuthFactory
@NonNullByDefault
public interface OAuthFactory
The OAuth Factory interface
- Author:
- Michael Bock - Initial contribution, Gary Tse - ESH Adaptation, Hilbrand Bouwkamp - Change create to have a handle as parameter.
-
Method Summary
Modifier and TypeMethodDescriptioncreateOAuthClientService
(String handle, String tokenUrl, @Nullable String authorizationUrl, String clientId, @Nullable String clientSecret, @Nullable String scope, @Nullable Boolean supportsBasicAuth) Creates a new OAuth service.void
deleteServiceAndAccessToken
(String handle) This method is for unget/unregister the service, then DELETE access token, configuration data from the store@Nullable OAuthClientService
getOAuthClientService
(String handle) Gets the OAuth service for a given handlevoid
ungetOAuthService
(String handle) Unget an OAuth service, this unget/unregister the service, and frees the resources.
-
Method Details
-
createOAuthClientService
OAuthClientService createOAuthClientService(String handle, String tokenUrl, @Nullable String authorizationUrl, String clientId, @Nullable String clientSecret, @Nullable String scope, @Nullable Boolean supportsBasicAuth) Creates a new OAuth service. Use this method only once to obtain a handle and store this handle for further in a persistent storage container.- Parameters:
handle
- the handle to the OAuth servicetokenUrl
- the token url of the OAuth provider. This is used for getting access token.authorizationUrl
- the authorization url of the OAuth provider. This is used purely for generating authorization code/ url.clientId
- the client idclientSecret
- the client secret (optional)scope
- the desired scopesupportsBasicAuth
- whether the OAuth provider supports basic authorization or the client id and client secret should be passed as form params. true - use http basic authentication, false - do not use http basic authentication, null - unknown (default to do not use)- Returns:
- the OAuth service
-
getOAuthClientService
Gets the OAuth service for a given handle- Parameters:
handle
- the handle to the OAuth service- Returns:
- the OAuth service or null if it doesn't exist
-
ungetOAuthService
Unget an OAuth service, this unget/unregister the service, and frees the resources. The existing tokens/ configurations (persisted parameters) are still saved in the store. It will internally callOAuthClientService#close()
. Best practise: unget, and close the OAuth service with this method! If OAuth service is closed directly, without using#ungetOAuthService(String)
, then a small residual footprint is left in the cache.- Parameters:
handle
- the handle to the OAuth service
-
deleteServiceAndAccessToken
This method is for unget/unregister the service, then DELETE access token, configuration data from the store- Parameters:
handle
- the handle to the OAuth service
-