Package org.pac4j.oauth.profile.facebook
Class FacebookProfileDefinition
- java.lang.Object
-
- org.pac4j.core.profile.definition.ProfileDefinition
-
- org.pac4j.core.profile.definition.CommonProfileDefinition
-
- org.pac4j.oauth.profile.definition.OAuthProfileDefinition
-
- org.pac4j.oauth.profile.facebook.FacebookProfileDefinition
-
public class FacebookProfileDefinition extends OAuthProfileDefinition
This class is the Facebook profile definition.- Since:
- 1.1.0
- Author:
- Jerome Leleu
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ABOUT
static java.lang.String
ALBUMS
protected static java.lang.String
APPSECRET_PARAMETER
protected static java.lang.String
BASE_URL
static java.lang.String
BIRTHDAY
static java.lang.String
BOOKS
static int
DEFAULT_LIMIT
static java.lang.String
EDUCATION
static java.lang.String
EVENTS
static java.lang.String
FAVORITE_ATHLETES
static java.lang.String
FAVORITE_TEAMS
static java.lang.String
FRIENDS
static java.lang.String
GROUPS
static java.lang.String
HOMETOWN
static java.lang.String
INTERESTED_IN
static java.lang.String
LANGUAGES
static java.lang.String
LAST_NAME
static java.lang.String
LIKES
static java.lang.String
LINK
static java.lang.String
MIDDLE_NAME
static java.lang.String
MOVIES
static java.lang.String
MUSIC
static java.lang.String
MUSIC_LISTENS
static java.lang.String
NAME
static java.lang.String
PICTURE
static java.lang.String
POLITICAL
static java.lang.String
QUOTES
static java.lang.String
RELATIONSHIP_STATUS
static java.lang.String
RELIGION
static java.lang.String
SIGNIFICANT_OTHER
static java.lang.String
THIRD_PARTY_ID
static java.lang.String
TIMEZONE
static java.lang.String
UPDATED_TIME
static java.lang.String
VERIFIED
static java.lang.String
WEBSITE
static java.lang.String
WORK
-
Constructor Summary
Constructors Constructor Description FacebookProfileDefinition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
computeAppSecretProof(java.lang.String url, com.github.scribejava.core.model.OAuth2AccessToken token, FacebookConfiguration configuration)
The code in this method is based on this blog post: https://www.sammyk.me/the-single-most-important-way-to-make-your-facebook-app-more-secure and this answer: https://stackoverflow.com/questions/7124735/hmac-sha256-algorithm-for-signature-calculationprotected void
extractData(FacebookProfile profile, com.fasterxml.jackson.databind.JsonNode json, java.lang.String name)
FacebookProfile
extractUserProfile(java.lang.String body)
Extract the user profile from the response (JSON, XML...) of the profile url.java.lang.String
getProfileUrl(com.github.scribejava.core.model.Token accessToken, OAuthConfiguration configuration)
Retrieve the url of the profile of the authenticated user for the provider.-
Methods inherited from class org.pac4j.oauth.profile.definition.OAuthProfileDefinition
getProfileVerb, raiseProfileExtractionError, raiseProfileExtractionJsonError, raiseProfileExtractionJsonError
-
Methods inherited from class org.pac4j.core.profile.definition.CommonProfileDefinition
configurePrimaryAttributes
-
Methods inherited from class org.pac4j.core.profile.definition.ProfileDefinition
convertAndAdd, convertAndAdd, getConverters, getParameter, getPrimaryAttributes, getProfileId, getSecondaryAttributes, isRestoreProfileFromTypedId, newProfile, primary, secondary, setProfileFactory, setProfileId, setRestoreProfileFromTypedId
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
MIDDLE_NAME
public static final java.lang.String MIDDLE_NAME
- See Also:
- Constant Field Values
-
LAST_NAME
public static final java.lang.String LAST_NAME
- See Also:
- Constant Field Values
-
LANGUAGES
public static final java.lang.String LANGUAGES
- See Also:
- Constant Field Values
-
LINK
public static final java.lang.String LINK
- See Also:
- Constant Field Values
-
THIRD_PARTY_ID
public static final java.lang.String THIRD_PARTY_ID
- See Also:
- Constant Field Values
-
TIMEZONE
public static final java.lang.String TIMEZONE
- See Also:
- Constant Field Values
-
UPDATED_TIME
public static final java.lang.String UPDATED_TIME
- See Also:
- Constant Field Values
-
VERIFIED
public static final java.lang.String VERIFIED
- See Also:
- Constant Field Values
-
ABOUT
public static final java.lang.String ABOUT
- See Also:
- Constant Field Values
-
BIRTHDAY
public static final java.lang.String BIRTHDAY
- See Also:
- Constant Field Values
-
EDUCATION
public static final java.lang.String EDUCATION
- See Also:
- Constant Field Values
-
HOMETOWN
public static final java.lang.String HOMETOWN
- See Also:
- Constant Field Values
-
INTERESTED_IN
public static final java.lang.String INTERESTED_IN
- See Also:
- Constant Field Values
-
POLITICAL
public static final java.lang.String POLITICAL
- See Also:
- Constant Field Values
-
FAVORITE_ATHLETES
public static final java.lang.String FAVORITE_ATHLETES
- See Also:
- Constant Field Values
-
FAVORITE_TEAMS
public static final java.lang.String FAVORITE_TEAMS
- See Also:
- Constant Field Values
-
QUOTES
public static final java.lang.String QUOTES
- See Also:
- Constant Field Values
-
RELATIONSHIP_STATUS
public static final java.lang.String RELATIONSHIP_STATUS
- See Also:
- Constant Field Values
-
RELIGION
public static final java.lang.String RELIGION
- See Also:
- Constant Field Values
-
SIGNIFICANT_OTHER
public static final java.lang.String SIGNIFICANT_OTHER
- See Also:
- Constant Field Values
-
WEBSITE
public static final java.lang.String WEBSITE
- See Also:
- Constant Field Values
-
WORK
public static final java.lang.String WORK
- See Also:
- Constant Field Values
-
FRIENDS
public static final java.lang.String FRIENDS
- See Also:
- Constant Field Values
-
MOVIES
public static final java.lang.String MOVIES
- See Also:
- Constant Field Values
-
MUSIC
public static final java.lang.String MUSIC
- See Also:
- Constant Field Values
-
BOOKS
public static final java.lang.String BOOKS
- See Also:
- Constant Field Values
-
LIKES
public static final java.lang.String LIKES
- See Also:
- Constant Field Values
-
ALBUMS
public static final java.lang.String ALBUMS
- See Also:
- Constant Field Values
-
EVENTS
public static final java.lang.String EVENTS
- See Also:
- Constant Field Values
-
GROUPS
public static final java.lang.String GROUPS
- See Also:
- Constant Field Values
-
MUSIC_LISTENS
public static final java.lang.String MUSIC_LISTENS
- See Also:
- Constant Field Values
-
PICTURE
public static final java.lang.String PICTURE
- See Also:
- Constant Field Values
-
DEFAULT_LIMIT
public static final int DEFAULT_LIMIT
- See Also:
- Constant Field Values
-
BASE_URL
protected static final java.lang.String BASE_URL
- See Also:
- Constant Field Values
-
APPSECRET_PARAMETER
protected static final java.lang.String APPSECRET_PARAMETER
- See Also:
- Constant Field Values
-
-
Method Detail
-
getProfileUrl
public java.lang.String getProfileUrl(com.github.scribejava.core.model.Token accessToken, OAuthConfiguration configuration)
Description copied from class:OAuthProfileDefinition
Retrieve the url of the profile of the authenticated user for the provider.- Specified by:
getProfileUrl
in classOAuthProfileDefinition
- Parameters:
accessToken
- only used when constructing dynamic urls from data in the tokenconfiguration
- the current configuration- Returns:
- the url of the user profile given by the provider
-
computeAppSecretProof
public java.lang.String computeAppSecretProof(java.lang.String url, com.github.scribejava.core.model.OAuth2AccessToken token, FacebookConfiguration configuration)
The code in this method is based on this blog post: https://www.sammyk.me/the-single-most-important-way-to-make-your-facebook-app-more-secure and this answer: https://stackoverflow.com/questions/7124735/hmac-sha256-algorithm-for-signature-calculation- Parameters:
url
- the URL to which we're adding the prooftoken
- the application token we pass back and forthconfiguration
- the current configuration- Returns:
- URL with the appsecret_proof parameter added
-
extractUserProfile
public FacebookProfile extractUserProfile(java.lang.String body)
Description copied from class:OAuthProfileDefinition
Extract the user profile from the response (JSON, XML...) of the profile url.- Specified by:
extractUserProfile
in classOAuthProfileDefinition
- Parameters:
body
- the response body- Returns:
- the returned profile
-
extractData
protected void extractData(FacebookProfile profile, com.fasterxml.jackson.databind.JsonNode json, java.lang.String name)
-
-