Package com.iizix.server.oauth.services
Class LinkedIn
- java.lang.Object
- com.iizix.server.oauth.AbstractOAuthService
- com.iizix.server.oauth.services.LinkedIn
- All Implemented Interfaces:
IOAuthService
public class LinkedIn extends AbstractOAuthService
The LinkedIn service.
Field Summary
Fields Modifier and Type Field Description static java.lang.String[]
DEFAULT_SCOPES
The default scopesSCOPE_r_liteprofile
andSCOPE_r_emailaddress
: {"r_emailaddress", "r_liteprofile"}, used when no scope is provided.static java.lang.String
SCOPE_r_emailaddress
The scope: email address, read only.static java.lang.String
SCOPE_r_liteprofile
The scope: basic profile, read only.Fields inherited from class com.iizix.server.oauth.AbstractOAuthService
ACCEPT_LANGUAGE, accessToken, service1, service2, session
Constructor Summary
Constructors Constructor Description LinkedIn(OAuthSession session, java.lang.String clientID, java.lang.String clientSecret, java.lang.String... scopes)
Constructs the service.
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Size
getApproximateSize()
Gets the approximate size in pixels of the inner browser window requested.AuthenticationProvider
getAuthenticationProvider()
Gets authentication provider.java.lang.String
getLogoutURL()
Returns the logout URL for the OAuth service.UserProfileInfo
getUserProfileInfo()
Gets the UserProfileInfo from this service.static IServiceCreator<LinkedIn>
initialize(java.lang.String clientID, java.lang.String clientSecret, java.lang.String... scopes)
Creates an instance of theParamInitializedService
that holds the parameters for the provider authentication.Methods inherited from class com.iizix.server.oauth.AbstractOAuthService
createServiceBuilder, dispose, disposeBlocked, disposeUserCancel, doAuthenticate, getAccessToken, getAccessToken1, getAccessToken2, getDebugOutputStream, getRequestAdditionalTime, invalidateAccessToken, validate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.iizix.comm.oauth.IOAuthService
getServiceName
Field Detail
SCOPE_r_liteprofile
public static final java.lang.String SCOPE_r_liteprofile
The scope: basic profile, read only. Today, only "r_liteprofile" is available and is unfortunately very limited."r_liteprofile" (v2)
"r_basicprofile" (v1), and
"r_fullprofile" (v1).- See Also:
- Constant Field Values
SCOPE_r_emailaddress
public static final java.lang.String SCOPE_r_emailaddress
The scope: email address, read only.- See Also:
- Constant Field Values
DEFAULT_SCOPES
public static final java.lang.String[] DEFAULT_SCOPES
The default scopesSCOPE_r_liteprofile
andSCOPE_r_emailaddress
: {"r_emailaddress", "r_liteprofile"}, used when no scope is provided.
Constructor Detail
LinkedIn
public LinkedIn(OAuthSession session, java.lang.String clientID, java.lang.String clientSecret, java.lang.String... scopes)
Constructs the service.- Parameters:
session
- The OAuthSession.clientID
- The Client ID.clientSecret
- The Client Secret.scopes
- The list of scopes as an array, or as one space delimited string. In order to retrieve the user profile information using{@link #getUserProfileInfo()}
, you MUST specify the scopes{@link #SCOPE_r_liteprofile}
and if you wish to also get the email address, you must also specify the scope{@link #SCOPE_r_emailaddress}
.- Throws:
java.lang.NullPointerException
- Ifsession
,clientID
orclientSecret
isnull
.java.lang.IllegalArgumentException
- IfclientID
orclientSecret
is empty String.java.lang.IllegalStateException
- If the authentication engine is not initialized.
Method Detail
initialize
public static IServiceCreator<LinkedIn> initialize(java.lang.String clientID, java.lang.String clientSecret, java.lang.String... scopes)
Creates an instance of theParamInitializedService
that holds the parameters for the provider authentication.- Parameters:
clientID
- The Client ID.clientSecret
- The Client Secret.scopes
- The list of scopes as an array, or as one space delimited string. In order to retrieve the user profile information using{@link #getUserProfileInfo()}
, you MUST specify the scopes{@link #SCOPE_r_liteprofile}
and if you wish to also get the email address, you must also specify the scope{@link #SCOPE_r_emailaddress}
.- Throws:
java.lang.NullPointerException
- IfclientID
,clientSecret
or any of thescopes
values are null isnull
.java.lang.IllegalArgumentException
- IfclientID
,clientSecret
or any of thescopes
values is empty.
getAuthenticationProvider
public AuthenticationProvider getAuthenticationProvider()
Gets authentication provider.- Returns:
- The authentication provider enum
AuthenticationProvider.LinkedIn
.
getApproximateSize
public Size getApproximateSize()
Gets the approximate size in pixels of the inner browser window requested. This setting used when possible, but is not guaranteed.- Returns:
- The size, or null if none is known (full screen).
getLogoutURL
public java.lang.String getLogoutURL()
Returns the logout URL for the OAuth service. It is not the same as invalidating an access URL.- Specified by:
getLogoutURL
in classAbstractOAuthService
- Returns:
- The logout URL.
getUserProfileInfo
public UserProfileInfo getUserProfileInfo() throws java.io.IOException, java.lang.InterruptedException, java.util.concurrent.ExecutionException
Gets the UserProfileInfo from this service.This will cause the user to have to authenticate with the service, unless not already done.
All fields available for this service that are possible to set and available will be initialized. Other values will be left
null
, unknown or undefined.- Specified by:
getUserProfileInfo
in classAbstractOAuthService
- Returns:
- The UserProfileInfo instance.
- Throws:
java.lang.IllegalStateException
- If the authentication has not completed successfully, or if the String"profile"
is not among the requested scopes.java.util.concurrent.ExecutionException
- For execution errors.java.lang.InterruptedException
- If the revocation action was interrupted.java.io.IOException
- For I/O errors.