Package org.pac4j.oauth.profile.wechat
Class WechatProfileDefinition
- 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<WechatProfile,OAuth20Configuration>
-
- org.pac4j.oauth.profile.wechat.WechatProfileDefinition
-
public class WechatProfileDefinition extends OAuth20ProfileDefinition<WechatProfile,OAuth20Configuration>
This class defines the attributes of the Wechat profile.More info at: https://api.weixin.qq.com/sns/userinfo
- Since:
- 3.1.0
- Author:
- zhangzhenli
-
-
Field Summary
Fields Modifier and Type Field Description static StringCITYstatic StringCOUNTRYcountry, For example, China is CNstatic StringHEADIMGURLUser avatar, the last value represents the size of the square avatar (0, 46, 64, 96, 132 values are optional, 0 is 640 * 640 square avatar), the item is empty when the user has no avatarstatic StringNICKNAMEstatic StringOPENIDstatic StringPRIVILEGEUser privilege information, json array, such as WeChat Waka users (chinaunicom)static StringPROVINCEstatic StringSEXGender, 1 male and 2 femalestatic StringUNIONIDUser union identity.-
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 WechatProfileDefinition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WechatProfileextractUserProfile(String body)Extract the user profile from the response (JSON, XML...) of the profile url.StringgetProfileUrl(com.github.scribejava.core.model.OAuth2AccessToken accessToken, OAuth20Configuration configuration)Retrieve the url of the profile of the authenticated user for the provider.-
Methods inherited from class org.pac4j.oauth.profile.definition.OAuthProfileDefinition
getProfileVerb, 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
-
-
-
-
Field Detail
-
OPENID
public static final String OPENID
- See Also:
- Constant Field Values
-
NICKNAME
public static final String NICKNAME
- See Also:
- Constant Field Values
-
SEX
public static final String SEX
Gender, 1 male and 2 female- See Also:
- Constant Field Values
-
PROVINCE
public static final String PROVINCE
- See Also:
- Constant Field Values
-
CITY
public static final String CITY
- See Also:
- Constant Field Values
-
COUNTRY
public static final String COUNTRY
country, For example, China is CN- See Also:
- Constant Field Values
-
HEADIMGURL
public static final String HEADIMGURL
User avatar, the last value represents the size of the square avatar (0, 46, 64, 96, 132 values are optional, 0 is 640 * 640 square avatar), the item is empty when the user has no avatar- See Also:
- Constant Field Values
-
PRIVILEGE
public static final String PRIVILEGE
User privilege information, json array, such as WeChat Waka users (chinaunicom)- See Also:
- Constant Field Values
-
UNIONID
public static final String UNIONID
User union identity. For an application under the WeChat open platform account, the unionid of the same user is unique.- See Also:
- Constant Field Values
-
-
Method Detail
-
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<WechatProfile,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 WechatProfile extractUserProfile(String body)
Description copied from class:OAuthProfileDefinitionExtract the user profile from the response (JSON, XML...) of the profile url.- Specified by:
extractUserProfilein classOAuthProfileDefinition<WechatProfile,com.github.scribejava.core.model.OAuth2AccessToken,OAuth20Configuration>- Parameters:
body- the response body- Returns:
- the returned profile
-
-