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.StringABOUTstatic java.lang.StringALBUMSprotected static java.lang.StringAPPSECRET_PARAMETERprotected static java.lang.StringBASE_URLstatic java.lang.StringBIRTHDAYstatic java.lang.StringBOOKSstatic intDEFAULT_LIMITstatic java.lang.StringEDUCATIONstatic java.lang.StringEVENTSstatic java.lang.StringFAVORITE_ATHLETESstatic java.lang.StringFAVORITE_TEAMSstatic java.lang.StringFRIENDSstatic java.lang.StringGROUPSstatic java.lang.StringHOMETOWNstatic java.lang.StringINTERESTED_INstatic java.lang.StringLANGUAGESstatic java.lang.StringLAST_NAMEstatic java.lang.StringLIKESstatic java.lang.StringLINKstatic java.lang.StringMIDDLE_NAMEstatic java.lang.StringMOVIESstatic java.lang.StringMUSICstatic java.lang.StringMUSIC_LISTENSstatic java.lang.StringNAMEstatic java.lang.StringPICTUREstatic java.lang.StringPOLITICALstatic java.lang.StringQUOTESstatic java.lang.StringRELATIONSHIP_STATUSstatic java.lang.StringRELIGIONstatic java.lang.StringSIGNIFICANT_OTHERstatic java.lang.StringTHIRD_PARTY_IDstatic java.lang.StringTIMEZONEstatic java.lang.StringUPDATED_TIMEstatic java.lang.StringVERIFIEDstatic java.lang.StringWEBSITEstatic java.lang.StringWORK
-
Constructor Summary
Constructors Constructor Description FacebookProfileDefinition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringcomputeAppSecretProof(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 voidextractData(FacebookProfile profile, com.fasterxml.jackson.databind.JsonNode json, java.lang.String name)FacebookProfileextractUserProfile(java.lang.String body)Extract the user profile from the response (JSON, XML...) of the profile url.java.lang.StringgetProfileUrl(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:OAuthProfileDefinitionRetrieve the url of the profile of the authenticated user for the provider.- Specified by:
getProfileUrlin 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:OAuthProfileDefinitionExtract the user profile from the response (JSON, XML...) of the profile url.- Specified by:
extractUserProfilein 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)
-
-