Class 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  
      • 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
    • 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-calculation
      protected 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.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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FacebookProfileDefinition

        public FacebookProfileDefinition()
    • 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 class OAuthProfileDefinition
        Parameters:
        accessToken - only used when constructing dynamic urls from data in the token
        configuration - 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 proof
        token - the application token we pass back and forth
        configuration - the current configuration
        Returns:
        URL with the appsecret_proof parameter added
      • extractData

        protected void extractData​(FacebookProfile profile,
                                   com.fasterxml.jackson.databind.JsonNode json,
                                   java.lang.String name)