Class OAuthProfileDefinition<P extends CommonProfile,T extends com.github.scribejava.core.model.Token,O extends OAuthConfiguration>
- java.lang.Object
-
- org.pac4j.core.profile.definition.ProfileDefinition<P>
-
- org.pac4j.core.profile.definition.CommonProfileDefinition<P>
-
- org.pac4j.oauth.profile.definition.OAuthProfileDefinition<P,T,O>
-
- Direct Known Subclasses:
OAuth10ProfileDefinition
,OAuth20ProfileDefinition
public abstract class OAuthProfileDefinition<P extends CommonProfile,T extends com.github.scribejava.core.model.Token,O extends OAuthConfiguration> extends CommonProfileDefinition<P>
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, newProfile
-
-
Constructor Summary
Constructors Constructor Description OAuthProfileDefinition()
OAuthProfileDefinition(ProfileFactory<P> profileFactory)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract P
extractUserProfile(String body)
Extract the user profile from the response (JSON, XML...) of the profile url.abstract String
getProfileUrl(T accessToken, O configuration)
Retrieve the url of the profile of the authenticated user for the provider.com.github.scribejava.core.model.Verb
getProfileVerb()
Get HTTP Method to request profile.protected void
raiseProfileExtractionError(String body)
Throws aTechnicalException
to indicate that user profile extraction has failed.protected void
raiseProfileExtractionJsonError(String body)
Throws aTechnicalException
to indicate that user profile extraction has failed.protected void
raiseProfileExtractionJsonError(String body, String missingNode)
Throws aTechnicalException
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, getPrimaryAttributes, getProfileId, getSecondaryAttributes, newProfile, primary, secondary, setProfileFactory, setProfileId
-
-
-
-
Constructor Detail
-
OAuthProfileDefinition
public OAuthProfileDefinition()
-
OAuthProfileDefinition
public OAuthProfileDefinition(ProfileFactory<P> profileFactory)
-
-
Method Detail
-
getProfileVerb
public com.github.scribejava.core.model.Verb getProfileVerb()
Get HTTP Method to request profile.- Returns:
- http verb
-
getProfileUrl
public abstract String getProfileUrl(T accessToken, O 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 tokenconfiguration
- the current configuration- Returns:
- the url of the user profile given by the provider
-
extractUserProfile
public abstract P 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 aTechnicalException
to indicate that user profile extraction has failed.- Parameters:
body
- the request body that the user profile should be have been extracted frommissingNode
- the name of a JSON node that was found missing. may be omitted
-
raiseProfileExtractionJsonError
protected void raiseProfileExtractionJsonError(String body)
Throws aTechnicalException
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 aTechnicalException
to indicate that user profile extraction has failed.- Parameters:
body
- the request body that the user profile should have been extracted from
-
-