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.
Since:
3.1.0
Author:
zhangzhenli
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Constant CITY="city"
    static final String
    country, For example, China is CN
    static final String
    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
    static final String
    Constant NICKNAME="nickname"
    static final String
    Constant OPENID="openid"
    static final String
    User privilege information, json array, such as WeChat Waka users (chinaunicom)
    static final String
    Constant PROVINCE="province"
    static final String
    Gender, 1 male and 2 female
    static final String
    User 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
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for WechatProfileDefinition.
  • Method Summary

    Modifier and Type
    Method
    Description
    Extract the user profile from the response (JSON, XML...) of the profile url.
    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.core.profile.definition.CommonProfileDefinition

    configurePrimaryAttributes

    Methods inherited from class org.pac4j.core.profile.definition.ProfileDefinition

    convertAndAdd, convertAndAdd, getConverters, getLogger, getParameter, getPrimaryAttributes, getProfileFactory, getProfileId, getSecondaryAttributes, isRestoreProfileFromTypedId, newProfile, primary, secondary, setProfileFactory, setProfileId, setRestoreProfileFromTypedId

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • OPENID

      public static final String OPENID
      Constant OPENID="openid"
      See Also:
    • NICKNAME

      public static final String NICKNAME
      Constant NICKNAME="nickname"
      See Also:
    • SEX

      public static final String SEX
      Gender, 1 male and 2 female
      See Also:
    • PROVINCE

      public static final String PROVINCE
      Constant PROVINCE="province"
      See Also:
    • CITY

      public static final String CITY
      Constant CITY="city"
      See Also:
    • COUNTRY

      public static final String COUNTRY
      country, For example, China is CN
      See Also:
    • 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:
    • PRIVILEGE

      public static final String PRIVILEGE
      User privilege information, json array, such as WeChat Waka users (chinaunicom)
      See Also:
    • 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:
  • Constructor Details

    • WechatProfileDefinition

      public WechatProfileDefinition()

      Constructor for WechatProfileDefinition.

  • Method Details

    • getProfileUrl

      public String getProfileUrl(com.github.scribejava.core.model.Token accessToken, OAuthConfiguration configuration)
      Retrieve the url of the profile of the authenticated user for the provider.
      Specified by:
      getProfileUrl in class OAuthProfileDefinition
      Parameters:
      accessToken - only used when constructing dynamic urls from data in the token
      configuration - the current configuration
      Returns:
      the url of the user profile given by the provider
    • extractUserProfile

      public WechatProfile extractUserProfile(String body)
      Extract the user profile from the response (JSON, XML...) of the profile url.
      Specified by:
      extractUserProfile in class OAuthProfileDefinition
      Parameters:
      body - the response body
      Returns:
      the returned profile