public class LinkedIn2Client extends BaseOAuth20StateClient<LinkedIn2Profile>
This class is the OAuth client to authenticate users in LinkedIn (using OAuth 2.0 protocol).
It returns a LinkedIn2Profile
.
The scope (by default : r_fullprofile
) can be specified using the setScope(String)
method, as well as the returned
fields through the setFields(String)
method.
More information at https://developer.linkedin.com/documents/profile-api
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_SCOPE |
protected String |
fields |
protected String |
scope |
logger, OAUTH_CODE
service
ATTEMPTED_AUTHENTICATION_SUFFIX, callbackUrl, callbackUrlResolver
Constructor and Description |
---|
LinkedIn2Client() |
LinkedIn2Client(String key,
String secret) |
Modifier and Type | Method and Description |
---|---|
protected LinkedIn2Profile |
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.
|
String |
getFields() |
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 |
hasBeenCancelled(WebContext context)
Return if the authentication has been cancelled.
|
protected void |
internalInit(WebContext context)
Internal initialization of the object.
|
void |
setFields(String fields) |
void |
setScope(String scope) |
buildOAuthConfig, getOAuthCredentials, getStateData, getStateParameter, retrieveAuthorizationUrl, setStateData
addAccessTokenToProfile, getAccessToken, signRequest
createOAuthRequest, getConnectTimeout, getKey, getReadTimeout, getResponseType, getSecret, hasOAuthGrantType, isTokenAsHeader, retrieveCredentials, retrieveRedirectAction, retrieveUserProfile, retrieveUserProfileFromToken, sendRequestForData, setConnectTimeout, setKey, setReadTimeout, setResponseType, setSecret, setTokenAsHeader
computeFinalCallbackUrl, getAjaxRequestResolver, getCallbackUrl, getCallbackUrlResolver, getCredentials, getRedirectAction, isIncludeClientNameInCallbackUrl, redirect, setAjaxRequestResolver, setCallbackUrl, setCallbackUrlResolver, setIncludeClientNameInCallbackUrl
addAuthorizationGenerator, getAuthorizationGenerators, getName, getUserProfile, setAuthorizationGenerator, setAuthorizationGenerators, setAuthorizationGenerators, setName, toString
init, reinit
public static final String DEFAULT_SCOPE
protected String scope
protected String fields
protected void internalInit(WebContext context)
InitializableWebObject
internalInit
in class BaseOAuthClient<LinkedIn2Profile,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<LinkedIn2Profile,com.github.scribejava.core.oauth.OAuth20Service,com.github.scribejava.core.model.OAuth2AccessToken>
protected String getOAuthScope()
BaseOAuthClient
getOAuthScope
in class BaseOAuthClient<LinkedIn2Profile,com.github.scribejava.core.oauth.OAuth20Service,com.github.scribejava.core.model.OAuth2AccessToken>
protected boolean hasBeenCancelled(WebContext context)
BaseOAuthClient
hasBeenCancelled
in class BaseOAuthClient<LinkedIn2Profile,com.github.scribejava.core.oauth.OAuth20Service,com.github.scribejava.core.model.OAuth2AccessToken>
context
- the web context.protected String getProfileUrl(com.github.scribejava.core.model.OAuth2AccessToken accessToken)
BaseOAuthClient
getProfileUrl
in class BaseOAuthClient<LinkedIn2Profile,com.github.scribejava.core.oauth.OAuth20Service,com.github.scribejava.core.model.OAuth2AccessToken>
accessToken
- only used when constructing dynamic urls from data in the tokenprotected LinkedIn2Profile extractUserProfile(String body) throws HttpAction
BaseOAuthClient
extractUserProfile
in class BaseOAuthClient<LinkedIn2Profile,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)
public String getFields()
public void setFields(String fields)
Copyright © 2016. All rights reserved.