Package org.pac4j.oauth.profile.facebook
Class FacebookProfileCreator
- java.lang.Object
-
- org.pac4j.oauth.profile.creator.OAuth20ProfileCreator<FacebookProfile>
-
- org.pac4j.oauth.profile.facebook.FacebookProfileCreator
-
- All Implemented Interfaces:
ProfileCreator<OAuth20Credentials>
public class FacebookProfileCreator extends OAuth20ProfileCreator<FacebookProfile>
A specific Facebook profile creator.- Since:
- 2.0.0
- Author:
- Jerome Leleu
-
-
Field Summary
Fields Modifier and Type Field Description protected IndirectClient
client
protected O
configuration
protected org.slf4j.Logger
logger
protected static com.fasterxml.jackson.databind.ObjectMapper
mapper
-
Constructor Summary
Constructors Constructor Description FacebookProfileCreator(OAuth20Configuration configuration, IndirectClient client)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
addExchangeToken(String url, com.github.scribejava.core.model.OAuth2AccessToken accessToken)
Adds the token to the URL in question.Optional<UserProfile>
create(C credentials, WebContext context)
protected com.github.scribejava.core.model.OAuthRequest
createOAuthRequest(String url, com.github.scribejava.core.model.Verb verb)
Create an OAuth request.protected Optional<UserProfile>
retrieveUserProfileFromToken(WebContext context, com.github.scribejava.core.model.OAuth2AccessToken accessToken)
Retrieve the user profile from the access token.protected String
sendRequestForData(S service, T accessToken, String dataUrl, com.github.scribejava.core.model.Verb verb)
Make a request to get the data of the authenticated user for the provider.-
Methods inherited from class org.pac4j.oauth.profile.creator.OAuth20ProfileCreator
addAccessTokenToProfile, getAccessToken, signRequest
-
-
-
-
Field Detail
-
logger
protected final org.slf4j.Logger logger
-
mapper
protected static final com.fasterxml.jackson.databind.ObjectMapper mapper
-
configuration
protected O extends OAuthConfiguration<S,T> configuration
-
client
protected IndirectClient client
-
-
Constructor Detail
-
FacebookProfileCreator
public FacebookProfileCreator(OAuth20Configuration configuration, IndirectClient client)
-
-
Method Detail
-
retrieveUserProfileFromToken
protected Optional<UserProfile> retrieveUserProfileFromToken(WebContext context, com.github.scribejava.core.model.OAuth2AccessToken accessToken)
Retrieve the user profile from the access token.- Parameters:
context
- the web contextaccessToken
- the access token- Returns:
- the user profile
-
addExchangeToken
protected String addExchangeToken(String url, com.github.scribejava.core.model.OAuth2AccessToken accessToken)
Adds the token to the URL in question. If we require appsecret_proof, then this method will also add the appsecret_proof parameter to the URL, as Facebook expects.- Parameters:
url
- the URL to modifyaccessToken
- the token we're passing back and forth- Returns:
- url with additional parameter(s)
-
create
public Optional<UserProfile> create(C credentials, WebContext context)
- Specified by:
create
in interfaceProfileCreator<C extends OAuthCredentials>
-
sendRequestForData
protected String sendRequestForData(S service, T accessToken, String dataUrl, com.github.scribejava.core.model.Verb verb)
Make a request to get the data of the authenticated user for the provider.- Parameters:
service
- the OAuth serviceaccessToken
- the access tokendataUrl
- url of the dataverb
- method used to request data- Returns:
- the user data response
-
createOAuthRequest
protected com.github.scribejava.core.model.OAuthRequest createOAuthRequest(String url, com.github.scribejava.core.model.Verb verb)
Create an OAuth request.- Parameters:
url
- the url to callverb
- method used to create the request- Returns:
- the request
-
-