Class WechatProfileCreator

  • All Implemented Interfaces:
    org.pac4j.core.profile.creator.ProfileCreator

    public class WechatProfileCreator
    extends OAuth20ProfileCreator
    Specific profile creator for Wechat.
    Since:
    3.1.0
    Author:
    zhangzhenli
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.pac4j.core.client.IndirectClient client  
      protected OAuthConfiguration configuration  
      protected org.slf4j.Logger logger  
      protected static com.fasterxml.jackson.databind.ObjectMapper mapper  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Optional<org.pac4j.core.profile.UserProfile> create​(org.pac4j.core.credentials.Credentials credentials, org.pac4j.core.context.WebContext context, org.pac4j.core.context.session.SessionStore sessionStore)  
      protected com.github.scribejava.core.model.OAuthRequest createOAuthRequest​(java.lang.String url, com.github.scribejava.core.model.Verb verb)
      Create an OAuth request.
      protected java.util.Optional<org.pac4j.core.profile.UserProfile> retrieveUserProfileFromToken​(org.pac4j.core.context.WebContext context, com.github.scribejava.core.model.Token accessToken)
      Retrieve the user profile from the access token.
      protected java.lang.String sendRequestForData​(com.github.scribejava.core.oauth.OAuthService service, com.github.scribejava.core.model.Token accessToken, java.lang.String dataUrl, com.github.scribejava.core.model.Verb verb)
      Make a request to get the data of the authenticated user for the provider.
      • Methods inherited from class java.lang.Object

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

      • logger

        protected final org.slf4j.Logger logger
      • mapper

        protected static final com.fasterxml.jackson.databind.ObjectMapper mapper
      • client

        protected org.pac4j.core.client.IndirectClient client
    • Constructor Detail

      • WechatProfileCreator

        public WechatProfileCreator​(OAuth20Configuration configuration,
                                    org.pac4j.core.client.IndirectClient client)
    • Method Detail

      • retrieveUserProfileFromToken

        protected java.util.Optional<org.pac4j.core.profile.UserProfile> retrieveUserProfileFromToken​(org.pac4j.core.context.WebContext context,
                                                                                                      com.github.scribejava.core.model.Token accessToken)
        Retrieve the user profile from the access token.
        Parameters:
        context - the web context
        accessToken - the access token
        Returns:
        the user profile
      • create

        public java.util.Optional<org.pac4j.core.profile.UserProfile> create​(org.pac4j.core.credentials.Credentials credentials,
                                                                             org.pac4j.core.context.WebContext context,
                                                                             org.pac4j.core.context.session.SessionStore sessionStore)
        Specified by:
        create in interface org.pac4j.core.profile.creator.ProfileCreator
      • sendRequestForData

        protected java.lang.String sendRequestForData​(com.github.scribejava.core.oauth.OAuthService service,
                                                      com.github.scribejava.core.model.Token accessToken,
                                                      java.lang.String dataUrl,
                                                      com.github.scribejava.core.model.Verb verb)
        Make a request to get the data of the authenticated user for the provider.
        Parameters:
        service - the OAuth service
        accessToken - the access token
        dataUrl - url of the data
        verb - method used to request data
        Returns:
        the user data response
      • createOAuthRequest

        protected com.github.scribejava.core.model.OAuthRequest createOAuthRequest​(java.lang.String url,
                                                                                   com.github.scribejava.core.model.Verb verb)
        Create an OAuth request.
        Parameters:
        url - the url to call
        verb - method used to create the request
        Returns:
        the request