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 Details

  • 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 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 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 proof
      token - the application token we pass back and forth
      configuration - the current configuration
      Returns:
      URL with the appsecret_proof parameter added
    • extractUserProfile

      public FacebookProfile extractUserProfile(String body)
      Extract the user profile from the response (JSON, XML...) of the profile url.
      Specified by:
      extractUserProfile in class OAuthProfileDefinition
      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 - a FacebookProfile object
      json - a JsonNode object
      name - a String object