Package org.pac4j.oauth.profile.creator
Class OAuth10ProfileCreator
java.lang.Object
org.pac4j.oauth.profile.creator.OAuth10ProfileCreator
- All Implemented Interfaces:
org.pac4j.core.profile.creator.ProfileCreator
- Direct Known Subclasses:
YahooProfileCreator
OAuth 1.0 profile creator.
- Since:
- 2.0.0
- Author:
- Jerome Leleu
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.pac4j.core.client.IndirectClientprotected OAuthConfigurationprotected final org.slf4j.Loggerprotected static final com.fasterxml.jackson.databind.ObjectMapperConstantmapper -
Constructor Summary
ConstructorsConstructorDescriptionOAuth10ProfileCreator(OAuth10Configuration configuration, org.pac4j.core.client.IndirectClient client) Constructor for OAuth10ProfileCreator. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddTokenToProfile(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.OAuthRequestcreateOAuthRequest(String url, com.github.scribejava.core.model.Verb verb) Create an OAuth request.protected com.github.scribejava.core.model.OAuth1AccessTokengetAccessToken(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 StringsendRequestForData(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 voidsignRequest(com.github.scribejava.core.oauth.OAuthService service, com.github.scribejava.core.model.Token tok, com.github.scribejava.core.model.OAuthRequest request) Sign the request.
-
Field Details
-
logger
protected final org.slf4j.Logger logger -
mapper
protected static final com.fasterxml.jackson.databind.ObjectMapper mapperConstantmapper -
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- aOAuth10Configurationobjectclient- aIndirectClientobject
-
-
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 profiletok- 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 servicetok- the tokenrequest- 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:
createin interfaceorg.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 contextaccessToken- 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 serviceaccessToken- the access tokendataUrl- url of the dataverb- 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 callverb- method used to create the request- Returns:
- the request
-