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 final String
     
    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
     
    static final String
     
    static final String
    User privilege information, json array, such as WeChat Waka users (chinaunicom)
    static final String
     
    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
     
  • 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, getParameter, getPrimaryAttributes, 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

  • Constructor Details

    • WechatProfileDefinition

      public WechatProfileDefinition()
  • Method Details

    • getProfileUrl

      public 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 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)
      Description copied from class: OAuthProfileDefinition
      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