Class FacebookClient
java.lang.Object
org.forgerock.oauth.clients.oauth2.OAuth2Client<FacebookClientConfiguration>
org.forgerock.oauth.clients.facebook.FacebookClient
- All Implemented Interfaces:
OAuthClient
OAuth 2.0 Client Implementation that supports Facebook.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringString used to represent the Client Credentials grand type.Fields inherited from class org.forgerock.oauth.clients.oauth2.OAuth2Client
ACCEPT_HEADER, ACCESS_TOKEN, addExpireTime, APPLICATION_JSON, AUTHORIZATION_CODE, AUTHORIZATION_HEADER, BASIC_AUTH, BEARER_TOKEN, CLIENT_ID, CLIENT_SECRET, clock, CODE, DATA, EXPIRE_TIME, EXPIRES_IN, GRANT_TYPE, HTTP_GET, HTTP_POST, httpHandler, LANDING_PAGE, PKCE_CODE_CHALLENGE, PKCE_CODE_CHALLENGE_METHOD, PKCE_CODE_VERIFIER, random, REDIRECT_URI, REFRESH_TOKEN, RESPONSE_MODE, RESPONSE_TYPE, SCOPE, STATE, TOKEN, TOKEN_TYPE, TOKEN_TYPE_HINT -
Constructor Summary
ConstructorsConstructorDescriptionFacebookClient(Handler httpHandler, FacebookClientConfiguration config, Clock clock, SecureRandom random) Constructs an FacebookClient using a providedHandlerandFacebookClientConfiguration. -
Method Summary
Modifier and TypeMethodDescriptionprotected Promise<JsonValue,OAuthException> getAppAccessToken(Context context) Retrieves the app access token from IDP.protected AsyncFunction<JsonValue,JsonValue, OAuthException> getInputTokenInfo(Context context, String inputToken) Retrieves the access token information as aJsonValue.Handle the data produced by the Auth Server as a result of a successful authentication and return the final redirect to the mobile device.protected Function<JsonValue,JsonValue, OAuthException> validateClientId(DataStore dataStore, JsonValue storedData, String inputToken) Compare client_id from access token associated data with configured client_id.Methods inherited from class org.forgerock.oauth.clients.oauth2.OAuth2Client
createAuthorizationState, createAuthRedirectUri, createAuthRedirectUri, createPkceVerifier, createPostAuthResponse, createPostResponse, createRequestForIntrospectEndpoint, createRequestForTokenEndpoint, createRequestForTokenEndpoint, createRequestForTokenRefresh, createRequestForUserInfoEndpoint, getAccessToken, getAccessTokenInfo, getAuthRedirect, getConfig, getFirstValueOrNull, getSessionInfo, getTokenEndpointHandler, getUserInfo, handlePostAuth, mapToJsonValue, mapToUserInfo, refresh, storeResponse, throwIfNoClientSecret
-
Field Details
-
CLIENT_CREDENTIALS
String used to represent the Client Credentials grand type.- See Also:
-
-
Constructor Details
-
FacebookClient
public FacebookClient(Handler httpHandler, FacebookClientConfiguration config, Clock clock, SecureRandom random) Constructs an FacebookClient using a providedHandlerandFacebookClientConfiguration.- Parameters:
httpHandler- Handler used to make Http calls to auth and resource servers.config- configuration that will be used to drive oauth flow.clock- Clock instancerandom- used to generate opaque, cryptographically secure strings.
-
-
Method Details
-
handleNativePostAuth
public Promise<JsonValue,OAuthException> handleNativePostAuth(Context context, DataStore dataStore, Map<String, List<String>> parameters) Description copied from interface:OAuthClientHandle 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 returnedJsonValueresponse will also contain the data passed toOAuthClient.getAuthRedirect(DataStore, String, URI).- Specified by:
handleNativePostAuthin interfaceOAuthClient- Overrides:
handleNativePostAuthin classOAuth2Client<FacebookClientConfiguration>- 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 theOAuthClient.getAuthRedirect(DataStore, String, URI)call;Promise, with a type ofOAuthException, when an error occurs.
-
getInputTokenInfo
protected AsyncFunction<JsonValue,JsonValue, getInputTokenInfoOAuthException> (Context context, String inputToken) Retrieves the access token information as aJsonValue. Invokes the introspection endpoint to validate the access token and returns a JSON representing the meta information surrounding the token.- Parameters:
context- Context chain used to keep a relationship between requests (tracking).inputToken- the token that needs to be inspected.- Returns:
- the meta information associated with the access token.
-
validateClientId
protected Function<JsonValue,JsonValue, validateClientIdOAuthException> (DataStore dataStore, JsonValue storedData, String inputToken) Description copied from class:OAuth2ClientCompare client_id from access token associated data with configured client_id.- Overrides:
validateClientIdin classOAuth2Client<FacebookClientConfiguration>- Parameters:
dataStore- data store in which to store the information.storedData- data that is in the storage implementation ofDataStore.inputToken- the token that needs to be inspected.- Returns:
- result of the access token validation.
-
getAppAccessToken
protected Promise<JsonValue,OAuthException> getAppAccessToken(Context context) throws OAuthException Retrieves the app access token from IDP. App access tokens are used to make requests to Facebook APIs on behalf of an app rather than a user. See App Access Tokens.- Parameters:
context- Context chain used to keep a relationship between requests (tracking).- Returns:
- the meta information associated with the access token.
- Throws:
OAuthException- if could not retrieve the app access token
-