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 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 service
      tokenUrl - 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 id
      clientSecret - the client secret (optional)
      scope - the desired scope
      supportsBasicAuth - 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

      @Nullable OAuthClientService getOAuthClientService(String handle)
      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

      void ungetOAuthService(String handle)
      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 call OAuthClientService#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

      void deleteServiceAndAccessToken(String handle)
      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