public class PayPalClient extends BaseOAuth20Client<PayPalProfile>
This class is the OAuth client to authenticate users in PayPal.
By default, the following scope is requested to PayPal : openid profile email address.
The scope can be defined to require permissions from the user and retrieve attributes from PayPal, by using the
setScope(String)
method.
It returns a PayPalProfile
.
More information at https://developer.paypal.com/webapps/developer/docs/integration/direct/log-in-with-paypal/detailed/
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_SCOPE |
protected String |
scope |
logger, OAUTH_CODE
service
ATTEMPTED_AUTHENTICATION_SUFFIX, callbackUrl, callbackUrlResolver
Constructor and Description |
---|
PayPalClient() |
PayPalClient(String key,
String secret) |
Modifier and Type | Method and Description |
---|---|
protected PayPalProfile |
extractUserProfile(String body)
Extract the user profile from the response (JSON, XML...) of the profile url.
|
protected com.github.scribejava.core.builder.api.BaseApi<com.github.scribejava.core.oauth.OAuth20Service> |
getApi()
Define the OAuth API for this client.
|
protected String |
getOAuthScope()
Define the OAuth scope for this client.
|
protected String |
getProfileUrl(com.github.scribejava.core.model.OAuth2AccessToken accessToken)
Retrieve the url of the profile of the authenticated user for the provider.
|
String |
getScope() |
protected boolean |
hasOAuthGrantType()
Whether the grant type must be added.
|
protected void |
internalInit(WebContext context)
Internal initialization of the object.
|
void |
setScope(String scope) |
addAccessTokenToProfile, getAccessToken, getOAuthCredentials, retrieveAuthorizationUrl, signRequest
buildOAuthConfig, createOAuthRequest, getConnectTimeout, getKey, getReadTimeout, getResponseType, getSecret, hasBeenCancelled, isTokenAsHeader, retrieveCredentials, retrieveRedirectAction, retrieveUserProfile, retrieveUserProfileFromToken, sendRequestForData, setConnectTimeout, setKey, setReadTimeout, setResponseType, setSecret, setTokenAsHeader
computeFinalCallbackUrl, getAjaxRequestResolver, getCallbackUrl, getCallbackUrlResolver, getCredentials, getRedirectAction, getStateParameter, isIncludeClientNameInCallbackUrl, redirect, setAjaxRequestResolver, setCallbackUrl, setCallbackUrlResolver, setIncludeClientNameInCallbackUrl, toString
addAuthorizationGenerator, addAuthorizationGenerators, getAuthorizationGenerators, getName, getUserProfile, setAuthorizationGenerator, setAuthorizationGenerators, setAuthorizationGenerators, setName
init, reinit
public static final String DEFAULT_SCOPE
protected String scope
protected void internalInit(WebContext context)
InitializableWebObject
internalInit
in class BaseOAuthClient<PayPalProfile,com.github.scribejava.core.oauth.OAuth20Service,com.github.scribejava.core.model.OAuth2AccessToken>
context
- the web contextprotected com.github.scribejava.core.builder.api.BaseApi<com.github.scribejava.core.oauth.OAuth20Service> getApi()
BaseOAuthClient
getApi
in class BaseOAuthClient<PayPalProfile,com.github.scribejava.core.oauth.OAuth20Service,com.github.scribejava.core.model.OAuth2AccessToken>
protected String getOAuthScope()
BaseOAuthClient
getOAuthScope
in class BaseOAuthClient<PayPalProfile,com.github.scribejava.core.oauth.OAuth20Service,com.github.scribejava.core.model.OAuth2AccessToken>
protected boolean hasOAuthGrantType()
BaseOAuthClient
hasOAuthGrantType
in class BaseOAuthClient<PayPalProfile,com.github.scribejava.core.oauth.OAuth20Service,com.github.scribejava.core.model.OAuth2AccessToken>
protected String getProfileUrl(com.github.scribejava.core.model.OAuth2AccessToken accessToken)
BaseOAuthClient
getProfileUrl
in class BaseOAuthClient<PayPalProfile,com.github.scribejava.core.oauth.OAuth20Service,com.github.scribejava.core.model.OAuth2AccessToken>
accessToken
- only used when constructing dynamic urls from data in the tokenprotected PayPalProfile extractUserProfile(String body) throws HttpAction
BaseOAuthClient
extractUserProfile
in class BaseOAuthClient<PayPalProfile,com.github.scribejava.core.oauth.OAuth20Service,com.github.scribejava.core.model.OAuth2AccessToken>
body
- the response bodyHttpAction
- whether an additional HTTP action is requiredpublic String getScope()
public void setScope(String scope)
Copyright © 2017. All rights reserved.