Package org.forgerock.oauth
Interface OAuthClient
- All Known Implementing Classes:
AppleClient
,FacebookClient
,LinkedInClient
,OAuth2Client
,OpenIDConnectClient
public interface OAuthClient
Generic interface for all OAuth-like clients.
-
Method Summary
Modifier and TypeMethodDescriptiongetAuthRedirect
(DataStore dataStore, String data, URI landingPage) Return the URI that the user agent should be redirected to, to authenticate and authorize access.Promise<? extends SessionInfo,
OAuthException> getSessionInfo
(DataStore dataStore) Validate whether an Auth Server session is still active and valid.getUserInfo
(DataStore dataStore) Return the authenticated user's info from the external authentication server.Handle the data produced by the Auth Server as a result of a successful authentication and return the final redirect to the mobile device.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 thegetAuthRedirect(DataStore, String, URI)
call.Refreshes a token if it has expired.
-
Method Details
-
getAuthRedirect
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 ofURI
, suitable for redirecting the user agent for external authentication and authorization and anPromise
, with a type ofOAuthException
, 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 thegetAuthRedirect(DataStore, String, URI)
call. Validate the request as secure. The returnedJsonValue
response will also contain the data passed togetAuthRedirect(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 ofJsonValue
, containing the landing page and the data value that was stored in the data store during thegetAuthRedirect(DataStore, String, URI)
call;Promise
, with a type ofOAuthException
, 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 returnedJsonValue
response will also contain the data passed togetAuthRedirect(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 ofJsonValue
, containing the data value that was stored in the data store during thegetAuthRedirect(DataStore, String, URI)
call;Promise
, with a type ofOAuthException
, when an error occurs.
-
getSessionInfo
Validate whether an Auth Server session is still active and valid. -
getUserInfo
Return the authenticated user's info from the external authentication server. -
refresh
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.
-