Package org.pac4j.oauth.profile.wechat
Class WechatProfileDefinition
- java.lang.Object
-
- org.pac4j.core.profile.definition.ProfileDefinition
-
- org.pac4j.core.profile.definition.CommonProfileDefinition
-
- org.pac4j.oauth.profile.definition.OAuthProfileDefinition
-
- org.pac4j.oauth.profile.wechat.WechatProfileDefinition
-
public class WechatProfileDefinition extends OAuthProfileDefinition
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 java.lang.String
CITY
static java.lang.String
COUNTRY
country, For example, China is CNstatic java.lang.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 avatarstatic java.lang.String
NICKNAME
static java.lang.String
OPENID
static java.lang.String
PRIVILEGE
User privilege information, json array, such as WeChat Waka users (chinaunicom)static java.lang.String
PROVINCE
static java.lang.String
SEX
Gender, 1 male and 2 femalestatic java.lang.String
UNIONID
User union identity.
-
Constructor Summary
Constructors Constructor Description WechatProfileDefinition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WechatProfile
extractUserProfile(java.lang.String body)
Extract the user profile from the response (JSON, XML...) of the profile url.java.lang.String
getProfileUrl(com.github.scribejava.core.model.Token accessToken, OAuthConfiguration 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, getParameter, getPrimaryAttributes, getProfileId, getSecondaryAttributes, isRestoreProfileFromTypedId, newProfile, primary, secondary, setProfileFactory, setProfileId, setRestoreProfileFromTypedId
-
-
-
-
Field Detail
-
OPENID
public static final java.lang.String OPENID
- See Also:
- Constant Field Values
-
NICKNAME
public static final java.lang.String NICKNAME
- See Also:
- Constant Field Values
-
SEX
public static final java.lang.String SEX
Gender, 1 male and 2 female- See Also:
- Constant Field Values
-
PROVINCE
public static final java.lang.String PROVINCE
- See Also:
- Constant Field Values
-
CITY
public static final java.lang.String CITY
- See Also:
- Constant Field Values
-
COUNTRY
public static final java.lang.String COUNTRY
country, For example, China is CN- See Also:
- Constant Field Values
-
HEADIMGURL
public static final java.lang.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 java.lang.String PRIVILEGE
User privilege information, json array, such as WeChat Waka users (chinaunicom)- See Also:
- Constant Field Values
-
UNIONID
public static final java.lang.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 java.lang.String getProfileUrl(com.github.scribejava.core.model.Token accessToken, OAuthConfiguration configuration)
Description copied from class:OAuthProfileDefinition
Retrieve the url of the profile of the authenticated user for the provider.- Specified by:
getProfileUrl
in classOAuthProfileDefinition
- 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(java.lang.String body)
Description copied from class:OAuthProfileDefinition
Extract the user profile from the response (JSON, XML...) of the profile url.- Specified by:
extractUserProfile
in classOAuthProfileDefinition
- Parameters:
body
- the response body- Returns:
- the returned profile
-
-