Class FacebookClient
- java.lang.Object
-
- org.forgerock.oauth.clients.oauth2.OAuth2Client<FacebookClientConfiguration>
-
- org.forgerock.oauth.clients.facebook.FacebookClient
-
- All Implemented Interfaces:
OAuthClient
public class FacebookClient extends OAuth2Client<FacebookClientConfiguration>
OAuth 2.0 Client Implementation that supports Facebook.
-
-
Field Summary
Fields Modifier and Type Field Description static String
CLIENT_CREDENTIALS
String 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
Constructors Constructor Description FacebookClient(Handler httpHandler, FacebookClientConfiguration config, Clock clock, SecureRandom random)
Constructs an FacebookClient using a providedHandler
andFacebookClientConfiguration
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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
.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.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 Detail
-
CLIENT_CREDENTIALS
public static final String CLIENT_CREDENTIALS
String used to represent the Client Credentials grand type.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FacebookClient
public FacebookClient(Handler httpHandler, FacebookClientConfiguration config, Clock clock, SecureRandom random)
Constructs an FacebookClient using a providedHandler
andFacebookClientConfiguration
.- 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 Detail
-
handleNativePostAuth
public Promise<JsonValue,OAuthException> handleNativePostAuth(Context context, DataStore dataStore, Map<String,List<String>> parameters)
Description copied from interface:OAuthClient
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 toOAuthClient.getAuthRedirect(DataStore, String, URI)
.- Specified by:
handleNativePostAuth
in interfaceOAuthClient
- Overrides:
handleNativePostAuth
in 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,OAuthException> getInputTokenInfo(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,OAuthException> validateClientId(DataStore dataStore, JsonValue storedData, String inputToken)
Description copied from class:OAuth2Client
Compare client_id from access token associated data with configured client_id.- Overrides:
validateClientId
in 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
-
-