Class OAuthProfileDefinition

java.lang.Object
org.pac4j.core.profile.definition.ProfileDefinition
org.pac4j.core.profile.definition.CommonProfileDefinition
org.pac4j.oauth.profile.definition.OAuthProfileDefinition
Direct Known Subclasses:
BitbucketProfileDefinition, CasOAuthWrapperProfileDefinition, CronofyProfileDefinition, DropBoxProfileDefinition, FacebookProfileDefinition, FigShareProfileDefinition, FoursquareProfileDefinition, GenericOAuth20ProfileDefinition, GitHubProfileDefinition, Google2ProfileDefinition, HiOrgServerProfileDefinition, LinkedIn2ProfileDefinition, OkProfileDefinition, PayPalProfileDefinition, QQProfileDefinition, StravaProfileDefinition, TwitterProfileDefinition, VkProfileDefinition, WechatProfileDefinition, WeiboProfileDefinition, WindowsLiveProfileDefinition, WordPressProfileDefinition, YahooProfileDefinition

public abstract class OAuthProfileDefinition extends org.pac4j.core.profile.definition.CommonProfileDefinition
OAuth profile definition.
Since:
2.0.0
Author:
Jerome Leleu
  • Field Summary

    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

    Constructors
    Constructor
    Description
     
    OAuthProfileDefinition(org.pac4j.core.profile.factory.ProfileFactory profileFactory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract org.pac4j.core.profile.CommonProfile
    Extract the user profile from the response (JSON, XML...) of the profile url.
    abstract String
    getProfileUrl(com.github.scribejava.core.model.Token accessToken, OAuthConfiguration configuration)
    Retrieve the url of the profile of the authenticated user for the provider.
    com.github.scribejava.core.model.Verb
    Get HTTP Method to request profile.
    protected void
    Throws a TechnicalException to indicate that user profile extraction has failed.
    protected void
    Throws a TechnicalException to indicate that user profile extraction has failed.
    protected void
    Throws a TechnicalException to indicate that user profile extraction has failed.

    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

    Methods inherited from class java.lang.Object

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

    • OAuthProfileDefinition

      public OAuthProfileDefinition()
    • OAuthProfileDefinition

      public OAuthProfileDefinition(org.pac4j.core.profile.factory.ProfileFactory profileFactory)
  • Method Details

    • getProfileVerb

      public com.github.scribejava.core.model.Verb getProfileVerb()
      Get HTTP Method to request profile.
      Returns:
      http verb
    • getProfileUrl

      public abstract String getProfileUrl(com.github.scribejava.core.model.Token accessToken, OAuthConfiguration configuration)
      Retrieve the url of the profile of the authenticated user for the provider.
      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
    • extractUserProfile

      public abstract org.pac4j.core.profile.CommonProfile extractUserProfile(String body)
      Extract the user profile from the response (JSON, XML...) of the profile url.
      Parameters:
      body - the response body
      Returns:
      the returned profile
    • raiseProfileExtractionJsonError

      protected void raiseProfileExtractionJsonError(String body, String missingNode)
      Throws a TechnicalException to indicate that user profile extraction has failed.
      Parameters:
      body - the request body that the user profile should be have been extracted from
      missingNode - the name of a JSON node that was found missing. may be omitted
    • raiseProfileExtractionJsonError

      protected void raiseProfileExtractionJsonError(String body)
      Throws a TechnicalException to indicate that user profile extraction has failed.
      Parameters:
      body - the request body that the user profile should have been extracted from
    • raiseProfileExtractionError

      protected void raiseProfileExtractionError(String body)
      Throws a TechnicalException to indicate that user profile extraction has failed.
      Parameters:
      body - the request body that the user profile should have been extracted from