Package org.pac4j.oauth.profile.generic
Class GenericOAuth20ProfileDefinition
- java.lang.Object
-
- org.pac4j.core.profile.definition.ProfileDefinition<P>
-
- org.pac4j.core.profile.definition.CommonProfileDefinition<P>
-
- org.pac4j.oauth.profile.definition.OAuthProfileDefinition<P,com.github.scribejava.core.model.OAuth2AccessToken,C>
-
- org.pac4j.oauth.profile.definition.OAuth20ProfileDefinition<OAuth20Profile,OAuth20Configuration>
-
- org.pac4j.oauth.profile.generic.GenericOAuth20ProfileDefinition
-
public class GenericOAuth20ProfileDefinition extends OAuth20ProfileDefinition<OAuth20Profile,OAuth20Configuration>
This class is the user profile for generic OAuth2 with appropriate getters.
The map of
profileAttributesis intended to replace the primary/secondary attributes where the key is the name of the attribute and the value is the path to obtain that attribute from the json response starting fromfirstNodePath- Author:
- Julio Arrebola
-
-
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 GenericOAuth20ProfileDefinition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OAuth20ProfileextractUserProfile(String body)Extract the user profile from the response (JSON, XML...) of the profile url.StringgetFirstNodePath()Map<String,String>getProfileAttributes()StringgetProfileUrl(com.github.scribejava.core.model.OAuth2AccessToken accessToken, OAuth20Configuration configuration)Retrieve the url of the profile of the authenticated user for the provider.com.github.scribejava.core.model.VerbgetProfileVerb()Get HTTP Method to request profile.voidprofileAttribute(String name, String tag, AttributeConverter<? extends Object> converter)Add an attribute as a primary one and its converter.voidprofileAttribute(String name, AttributeConverter<? extends Object> converter)Add an attribute as a primary one and its converter.voidsetFirstNodePath(String firstNodePath)voidsetProfileUrl(String profileUrl)voidsetProfileVerb(com.github.scribejava.core.model.Verb value)-
Methods inherited from class org.pac4j.oauth.profile.definition.OAuthProfileDefinition
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, getPrimaryAttributes, getProfileId, getSecondaryAttributes, newProfile, primary, secondary, setProfileFactory, setProfileId
-
-
-
-
Method Detail
-
setProfileVerb
public void setProfileVerb(com.github.scribejava.core.model.Verb value)
-
getProfileVerb
public com.github.scribejava.core.model.Verb getProfileVerb()
Description copied from class:OAuthProfileDefinitionGet HTTP Method to request profile.- Overrides:
getProfileVerbin classOAuthProfileDefinition<OAuth20Profile,com.github.scribejava.core.model.OAuth2AccessToken,OAuth20Configuration>- Returns:
- http verb
-
setProfileUrl
public void setProfileUrl(String profileUrl)
-
getProfileUrl
public String getProfileUrl(com.github.scribejava.core.model.OAuth2AccessToken accessToken, OAuth20Configuration configuration)
Description copied from class:OAuthProfileDefinitionRetrieve the url of the profile of the authenticated user for the provider.- Specified by:
getProfileUrlin classOAuthProfileDefinition<OAuth20Profile,com.github.scribejava.core.model.OAuth2AccessToken,OAuth20Configuration>- 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 OAuth20Profile extractUserProfile(String body)
Description copied from class:OAuthProfileDefinitionExtract the user profile from the response (JSON, XML...) of the profile url.- Specified by:
extractUserProfilein classOAuthProfileDefinition<OAuth20Profile,com.github.scribejava.core.model.OAuth2AccessToken,OAuth20Configuration>- Parameters:
body- the response body- Returns:
- the returned profile
-
profileAttribute
public void profileAttribute(String name, AttributeConverter<? extends Object> converter)
Add an attribute as a primary one and its converter.- Parameters:
name- name of the attributeconverter- converter
-
profileAttribute
public void profileAttribute(String name, String tag, AttributeConverter<? extends Object> converter)
Add an attribute as a primary one and its converter.- Parameters:
name- name of the attributetag- json referenceconverter- converter
-
getFirstNodePath
public String getFirstNodePath()
-
setFirstNodePath
public void setFirstNodePath(String firstNodePath)
-
-