public class GenericOAuth20ProfileDefinition extends OAuth20ProfileDefinition<OAuth20Profile>
This class is the user profile for generic OAuth2 with appropriate getters.
The map of profileAttributes
is intended to replate 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 resopnse, starting from firstNodePath
DISPLAY_NAME, EMAIL, FAMILY_NAME, FIRST_NAME, GENDER, LOCALE, LOCATION, PICTURE_URL, PROFILE_URL
logger, newProfile
Constructor and Description |
---|
GenericOAuth20ProfileDefinition() |
Modifier and Type | Method and Description |
---|---|
OAuth20Profile |
extractUserProfile(String body)
Extract the user profile from the response (JSON, XML...) of the profile url.
|
String |
getFirstNodePath() |
Map<String,String> |
getProfileAttributes() |
String |
getProfileUrl(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.Verb |
getProfileVerb()
Get HTTP Method to request profile.
|
void |
profileAttribute(String name,
AttributeConverter<? extends Object> converter)
Add an attribute as a primary one and its converter.
|
void |
profileAttribute(String name,
String tag,
AttributeConverter<? extends Object> converter)
Add an attribute as a primary one and its converter.
|
void |
setFirstNodePath(String firstNodePath) |
void |
setProfileUrl(String profileUrl) |
void |
setProfileVerb(com.github.scribejava.core.model.Verb value) |
convertAndAdd, convertAndAdd, getConverters, getPrimaryAttributes, getSecondaryAttributes, newProfile, primary, secondary, setProfileFactory
public void setProfileVerb(com.github.scribejava.core.model.Verb value)
public com.github.scribejava.core.model.Verb getProfileVerb()
OAuthProfileDefinition
getProfileVerb
in class OAuthProfileDefinition<OAuth20Profile,com.github.scribejava.core.model.OAuth2AccessToken,OAuth20Configuration>
public void setProfileUrl(String profileUrl)
public String getProfileUrl(com.github.scribejava.core.model.OAuth2AccessToken accessToken, OAuth20Configuration configuration)
OAuthProfileDefinition
getProfileUrl
in class OAuthProfileDefinition<OAuth20Profile,com.github.scribejava.core.model.OAuth2AccessToken,OAuth20Configuration>
accessToken
- only used when constructing dynamic urls from data in the tokenconfiguration
- the current configurationpublic OAuth20Profile extractUserProfile(String body) throws HttpAction
OAuthProfileDefinition
extractUserProfile
in class OAuthProfileDefinition<OAuth20Profile,com.github.scribejava.core.model.OAuth2AccessToken,OAuth20Configuration>
body
- the response bodyHttpAction
- whether an extra HTTP action is requiredpublic void profileAttribute(String name, AttributeConverter<? extends Object> converter)
name
- name of the attributeconverter
- converterpublic void profileAttribute(String name, String tag, AttributeConverter<? extends Object> converter)
name
- name of the attributetag
- json referenceconverter
- converterpublic String getFirstNodePath()
public void setFirstNodePath(String firstNodePath)
Copyright © 2017. All rights reserved.