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
This class is the Facebook profile definition.
- Since:
- 1.1.0
- Author:
- Jerome Leleu
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
ConstantABOUT="about"
static final String
ConstantALBUMS="albums"
protected static final String
ConstantAPPSECRET_PARAMETER="appsecret_proof"
protected static final String
ConstantBASE_URL="https://graph.facebook.com/v2.8/me"
static final String
ConstantBIRTHDAY="birthday"
static final String
ConstantBOOKS="books"
static final int
ConstantDEFAULT_LIMIT=0
static final String
ConstantEDUCATION="education"
static final String
ConstantEVENTS="events"
static final String
ConstantFAVORITE_ATHLETES="favorite_athletes"
static final String
ConstantFAVORITE_TEAMS="favorite_teams"
static final String
ConstantFRIENDS="friends"
static final String
ConstantGROUPS="groups"
static final String
ConstantHOMETOWN="hometown"
static final String
ConstantINTERESTED_IN="interested_in"
static final String
ConstantLANGUAGES="languages"
static final String
ConstantLAST_NAME="last_name"
static final String
ConstantLIKES="likes"
static final String
ConstantLINK="link"
static final String
ConstantMIDDLE_NAME="middle_name"
static final String
ConstantMOVIES="movies"
static final String
ConstantMUSIC="music"
static final String
ConstantMUSIC_LISTENS="music.listens"
static final String
ConstantNAME="name"
static final String
ConstantPICTURE="picture"
static final String
ConstantPOLITICAL="political"
static final String
ConstantQUOTES="quotes"
static final String
ConstantRELATIONSHIP_STATUS="relationship_status"
static final String
ConstantRELIGION="religion"
static final String
ConstantSIGNIFICANT_OTHER="significant_other"
static final String
ConstantTHIRD_PARTY_ID="third_party_id"
static final String
ConstantTIMEZONE="timezone"
static final String
ConstantUPDATED_TIME="updated_time"
static final String
ConstantVERIFIED="verified"
static final String
ConstantWEBSITE="website"
static final String
ConstantWORK="work"
Fields inherited from class org.pac4j.core.profile.definition.CommonProfileDefinition
DISPLAY_NAME, EMAIL, FAMILY_NAME, FIRST_NAME, GENDER, LOCALE, LOCATION, PICTURE_URL, PROFILE_URL
Fields inherited from class org.pac4j.core.profile.definition.ProfileDefinition
logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncomputeAppSecretProof
(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
(org.pac4j.core.profile.UserProfile profile, com.fasterxml.jackson.databind.JsonNode json, String name) extractData.extractUserProfile
(String body) Extract the user profile from the response (JSON, XML...) of the profile url.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, getLogger, getParameter, getPrimaryAttributes, getProfileFactory, getProfileId, getSecondaryAttributes, isRestoreProfileFromTypedId, newProfile, primary, secondary, setProfileFactory, setProfileId, setRestoreProfileFromTypedId
-
Field Details
-
NAME
ConstantNAME="name"
- See Also:
-
MIDDLE_NAME
ConstantMIDDLE_NAME="middle_name"
- See Also:
-
LAST_NAME
ConstantLAST_NAME="last_name"
- See Also:
-
LANGUAGES
ConstantLANGUAGES="languages"
- See Also:
-
LINK
ConstantLINK="link"
- See Also:
-
THIRD_PARTY_ID
ConstantTHIRD_PARTY_ID="third_party_id"
- See Also:
-
TIMEZONE
ConstantTIMEZONE="timezone"
- See Also:
-
UPDATED_TIME
ConstantUPDATED_TIME="updated_time"
- See Also:
-
VERIFIED
ConstantVERIFIED="verified"
- See Also:
-
ABOUT
ConstantABOUT="about"
- See Also:
-
BIRTHDAY
ConstantBIRTHDAY="birthday"
- See Also:
-
EDUCATION
ConstantEDUCATION="education"
- See Also:
-
HOMETOWN
ConstantHOMETOWN="hometown"
- See Also:
-
INTERESTED_IN
ConstantINTERESTED_IN="interested_in"
- See Also:
-
POLITICAL
ConstantPOLITICAL="political"
- See Also:
-
FAVORITE_ATHLETES
ConstantFAVORITE_ATHLETES="favorite_athletes"
- See Also:
-
FAVORITE_TEAMS
ConstantFAVORITE_TEAMS="favorite_teams"
- See Also:
-
QUOTES
ConstantQUOTES="quotes"
- See Also:
-
RELATIONSHIP_STATUS
ConstantRELATIONSHIP_STATUS="relationship_status"
- See Also:
-
RELIGION
ConstantRELIGION="religion"
- See Also:
-
SIGNIFICANT_OTHER
ConstantSIGNIFICANT_OTHER="significant_other"
- See Also:
-
WEBSITE
ConstantWEBSITE="website"
- See Also:
-
WORK
ConstantWORK="work"
- See Also:
-
FRIENDS
ConstantFRIENDS="friends"
- See Also:
-
MOVIES
ConstantMOVIES="movies"
- See Also:
-
MUSIC
ConstantMUSIC="music"
- See Also:
-
BOOKS
ConstantBOOKS="books"
- See Also:
-
LIKES
ConstantLIKES="likes"
- See Also:
-
ALBUMS
ConstantALBUMS="albums"
- See Also:
-
EVENTS
ConstantEVENTS="events"
- See Also:
-
GROUPS
ConstantGROUPS="groups"
- See Also:
-
MUSIC_LISTENS
ConstantMUSIC_LISTENS="music.listens"
- See Also:
-
PICTURE
ConstantPICTURE="picture"
- See Also:
-
DEFAULT_LIMIT
public static final int DEFAULT_LIMITConstantDEFAULT_LIMIT=0
- See Also:
-
BASE_URL
ConstantBASE_URL="https://graph.facebook.com/v2.8/me"
- See Also:
-
APPSECRET_PARAMETER
ConstantAPPSECRET_PARAMETER="appsecret_proof"
- See Also:
-
-
Constructor Details
-
FacebookProfileDefinition
public FacebookProfileDefinition()Constructor for FacebookProfileDefinition.
-
-
Method Details
-
getProfileUrl
public String getProfileUrl(com.github.scribejava.core.model.Token accessToken, OAuthConfiguration configuration) 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 String computeAppSecretProof(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
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(org.pac4j.core.profile.UserProfile profile, com.fasterxml.jackson.databind.JsonNode json, String name) extractData.
- Parameters:
profile
- aFacebookProfile
objectjson
- aJsonNode
objectname
- aString
object
-