Class OAuth10ProfileCreator

java.lang.Object
org.pac4j.oauth.profile.creator.OAuth10ProfileCreator
All Implemented Interfaces:
org.pac4j.core.profile.creator.ProfileCreator
Direct Known Subclasses:
YahooProfileCreator

public class OAuth10ProfileCreator extends Object
OAuth 1.0 profile creator.
Since:
2.0.0
Author:
Jerome Leleu
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.pac4j.core.client.IndirectClient
     
     
    protected final org.slf4j.Logger
     
    protected static final com.fasterxml.jackson.databind.ObjectMapper
    Constant mapper
  • Constructor Summary

    Constructors
    Constructor
    Description
    OAuth10ProfileCreator(OAuth10Configuration configuration, org.pac4j.core.client.IndirectClient client)
    Constructor for OAuth10ProfileCreator.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    addTokenToProfile(org.pac4j.core.profile.UserProfile userProfile, com.github.scribejava.core.model.Token tok)
    Add the access token to the profile (as an attribute).
    Optional<org.pac4j.core.profile.UserProfile>
    create(org.pac4j.core.context.CallContext ctx, org.pac4j.core.credentials.Credentials credentials)
    protected com.github.scribejava.core.model.OAuthRequest
    createOAuthRequest(String url, com.github.scribejava.core.model.Verb verb)
    Create an OAuth request.
    protected com.github.scribejava.core.model.OAuth1AccessToken
    getAccessToken(org.pac4j.core.credentials.Credentials credentials)
    Get the access token from OAuth credentials.
    protected 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 String
    sendRequestForData(com.github.scribejava.core.oauth.OAuthService service, com.github.scribejava.core.model.Token accessToken, String dataUrl, com.github.scribejava.core.model.Verb verb)
    Make a request to get the data of the authenticated user for the provider.
    protected void
    signRequest(com.github.scribejava.core.oauth.OAuthService service, com.github.scribejava.core.model.Token tok, com.github.scribejava.core.model.OAuthRequest request)
    Sign the request.

    Methods inherited from class java.lang.Object

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

    • logger

      protected final org.slf4j.Logger logger
    • mapper

      protected static final com.fasterxml.jackson.databind.ObjectMapper mapper
      Constant mapper
    • configuration

      protected OAuthConfiguration configuration
    • client

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

    • OAuth10ProfileCreator

      public OAuth10ProfileCreator(OAuth10Configuration configuration, org.pac4j.core.client.IndirectClient client)

      Constructor for OAuth10ProfileCreator.

      Parameters:
      configuration - a OAuth10Configuration object
      client - a IndirectClient object
  • Method Details

    • getAccessToken

      protected com.github.scribejava.core.model.OAuth1AccessToken getAccessToken(org.pac4j.core.credentials.Credentials credentials)
      Get the access token from OAuth credentials.
      Parameters:
      credentials - credentials
      Returns:
      the access token
    • addTokenToProfile

      protected void addTokenToProfile(org.pac4j.core.profile.UserProfile userProfile, com.github.scribejava.core.model.Token tok)
      Add the access token to the profile (as an attribute).
      Parameters:
      userProfile - the user profile
      tok - the access token
    • signRequest

      protected void signRequest(com.github.scribejava.core.oauth.OAuthService service, com.github.scribejava.core.model.Token tok, com.github.scribejava.core.model.OAuthRequest request)
      Sign the request.
      Parameters:
      service - the service
      tok - the token
      request - the request
    • create

      public Optional<org.pac4j.core.profile.UserProfile> create(org.pac4j.core.context.CallContext ctx, org.pac4j.core.credentials.Credentials credentials)
      Specified by:
      create in interface org.pac4j.core.profile.creator.ProfileCreator
    • retrieveUserProfileFromToken

      protected 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
    • sendRequestForData

      protected String sendRequestForData(com.github.scribejava.core.oauth.OAuthService service, com.github.scribejava.core.model.Token accessToken, 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(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