public abstract class SocialProvider extends Object
Base class for all itendity providers
The code is modified from https://github.com/jaliss/securesocial
| Modifier and Type | Class and Description |
|---|---|
static class |
SocialProvider.Manager |
static class |
SocialProvider.Resolver |
| Modifier and Type | Field and Description |
|---|---|
protected AuthenticationMethod |
authMethod
The authentication method used by this provider
|
protected String |
callbackUrl |
protected Config |
config
The configuration for the provider
|
protected String |
id
The provider ID.
|
protected org.osgl.logging.Logger |
logger |
| Constructor and Description |
|---|
SocialProvider(String id,
AuthenticationMethod authMethod)
Creates a new IdentityProvider
|
| Modifier and Type | Method and Description |
|---|---|
protected static StringBuilder |
appendParam(StringBuilder sb,
String key,
String val) |
protected static StringBuilder |
appendParams(StringBuilder sb,
Map<String,String> args) |
abstract String |
authUrl(String callback,
String payload)
Returns the authentication URL of this provider
|
protected String |
callbackUrl() |
protected String |
callbackUrl(String callback,
String payload) |
void |
checkCsrfToken(String csrfToken) |
abstract SocialProfile |
doAuth(String code,
String act_callback,
String act_payload)
Subclasses must implement the authentication logic in this method
|
abstract void |
fillProfile(SocialProfile user)
Once the user is authenticated this method is called to retrieve profile information from the provider.
|
protected okhttp3.Request |
finishBuildingRequest(okhttp3.Request.Builder builder,
Map<String,String> params) |
String |
getId() |
protected com.alibaba.fastjson.JSONObject |
readUrlAsJson(String url,
Map<String,String> params,
boolean post) |
protected String |
readUrlAsString(String url,
Map<String,String> params,
boolean post) |
String |
toString() |
protected final org.osgl.logging.Logger logger
protected String id
The provider ID.
protected Config config
The configuration for the provider
protected AuthenticationMethod authMethod
The authentication method used by this provider
protected String callbackUrl
public SocialProvider(String id, AuthenticationMethod authMethod)
Creates a new IdentityProvider
id - The type for this providerauthMethod - The authentication method used by this providerpublic String getId()
public void checkCsrfToken(String csrfToken)
public abstract SocialProfile doAuth(String code, String act_callback, String act_payload)
Subclasses must implement the authentication logic in this method
act_callback - the url to which the user is redirected once social authentication process finishedact_payload - the addtional data app would like to pass through the social authentication processcode - the auth codeprotected static StringBuilder appendParam(StringBuilder sb, String key, String val)
protected static StringBuilder appendParams(StringBuilder sb, Map<String,String> args)
public abstract void fillProfile(SocialProfile user)
Once the user is authenticated this method is called to retrieve profile information from the provider.
user - A SocialProfilepublic abstract String authUrl(String callback, String payload)
Returns the authentication URL of this provider
callback - the callback URL to which user is redirected once social authentication process is donepayload - the additional data user app might want to passed through the social link processprotected String callbackUrl()
protected String readUrlAsString(String url, Map<String,String> params, boolean post)
protected com.alibaba.fastjson.JSONObject readUrlAsJson(String url, Map<String,String> params, boolean post)
Copyright © 2016–2018 ActFramework. All rights reserved.