Interface OAuthClient

All Known Implementing Classes:
AppleClient, FacebookClient, LinkedInClient, OAuth2Client, OpenIDConnectClient

public interface OAuthClient
Generic interface for all OAuth-like clients.
  • Method Details

    • getAuthRedirect

      Promise<URI,OAuthException> getAuthRedirect(DataStore dataStore, String data, URI landingPage)
      Return the URI that the user agent should be redirected to, to authenticate and authorize access.
      Parameters:
      dataStore - The data store that contains information about the OAuth interaction.
      data - A value which will be stored in the data store to be returned as part of the final landing page redirect response, this MUST be URI safe.
      landingPage - The final page a user agent should be sent following successful authentication.
      Returns:
      Promise, with a type of URI, suitable for redirecting the user agent for external authentication and authorization and an Promise, with a type of OAuthException, when an error occurs.
    • handlePostAuth

      Promise<JsonValue,OAuthException> handlePostAuth(DataStore dataStore, Map<String,List<String>> requestParameters)
      Handle the data produced by the Auth Server as a result of a successful authentication and return the final redirect to the landing page specified in the getAuthRedirect(DataStore, String, URI) call. Validate the request as secure. The returned JsonValue response will also contain the data passed to getAuthRedirect(DataStore, String, URI).
      Parameters:
      dataStore - The data store that contains information about the OAuth interaction.
      requestParameters - The request parameters containing the data produced by the external authentication server.
      Returns:
      Promise, with a type of JsonValue, containing the landing page and the data value that was stored in the data store during the getAuthRedirect(DataStore, String, URI) call; Promise, with a type of OAuthException, when an error occurs.
    • handleNativePostAuth

      Promise<JsonValue,OAuthException> handleNativePostAuth(Context context, DataStore dataStore, Map<String,List<String>> parameters)
      Handle the data produced by the Auth Server as a result of a successful authentication and return the final redirect to the mobile device. Validate the request as secure. The returned JsonValue response will also contain the data passed to getAuthRedirect(DataStore, String, URI).
      Parameters:
      context - Context chain used to keep a relationship between requests (tracking)
      dataStore - The data store that contains information about the OAuth interaction.
      parameters - The parameters containing the data sent by the external mobile device.
      Returns:
      Promise, with a type of JsonValue, containing the data value that was stored in the data store during the getAuthRedirect(DataStore, String, URI) call; Promise, with a type of OAuthException, when an error occurs.
    • getSessionInfo

      Promise<? extends SessionInfo,OAuthException> getSessionInfo(DataStore dataStore)
      Validate whether an Auth Server session is still active and valid.
      Parameters:
      dataStore - The data store that contains information about the OAuth interaction.
      Returns:
      Promise, with a type of SessionInfo, representing information about the session. Promise, with a type of OAuthException, when an error occurs.
    • getUserInfo

      Promise<UserInfo,OAuthException> getUserInfo(DataStore dataStore)
      Return the authenticated user's info from the external authentication server.
      Parameters:
      dataStore - The data store that contains information about the OAuth interaction.
      Returns:
      Promise, with a type of UserInfo, containing the available user info. Promise, with a type of OAuthException, when an error occurs.
    • refresh

      Promise<Void,OAuthException> refresh(DataStore dataStore)
      Refreshes a token if it has expired.
      Parameters:
      dataStore - The data store that contains information about the OAuth interaction.
      Returns:
      Promise If a new token has been retrieved, update the data store with the new token. OAuthException when an error occurs.