Package org.javlo.service.social
Class AbstractSocialNetwork
- java.lang.Object
-
- org.javlo.service.social.AbstractSocialNetwork
-
- All Implemented Interfaces:
ISocialNetwork
- Direct Known Subclasses:
Facebook,Google,Linkedin,Pushbullet,Twitter
public abstract class AbstractSocialNetwork extends Object implements ISocialNetwork
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,String>data-
Fields inherited from interface org.javlo.service.social.ISocialNetwork
POPUP_URI_SUFFIX
-
-
Constructor Summary
Constructors Constructor Description AbstractSocialNetwork()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected org.apache.oltu.oauth2.client.request.OAuthClientRequestbuildAuthenticationRequest(org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder builder)protected org.apache.oltu.oauth2.client.request.OAuthClientRequestbuildTokenRequest(org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder builder)protected voidconfigureAuthenticationRequest(org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder builder, String clientId, ContentContext ctx, boolean popup)protected voidconfigureTokenRequest(org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder builder, String clientId, String clientSecret, String code)protected org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuildercreateAuthenticationRequest()protected org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuildercreateTokenRequest()protected org.apache.oltu.oauth2.client.response.OAuthAccessTokenResponseexecuteTokenRequest(org.apache.oltu.oauth2.client.OAuthClient oAuthClient, org.apache.oltu.oauth2.client.request.OAuthClientRequest request)protected voidfillUserInfo(UserInfo userInfo, SocialUser socialUser)StringgetAccessToken(String code, org.apache.oltu.oauth2.client.OAuthClient oAuthClient)StringgetApiKey()abstract StringgetAuthzEndpoint()StringgetClientId()StringgetClientSecret()Map<String,String>getData()StringgetLogin()StringgetLoginURL()StringgetRedirectURL()StringgetSigninURL(ContentContext ctx, boolean popup)protected SocialUsergetSocialUser(String accessToken, org.apache.oltu.oauth2.client.OAuthClient oAuthClient)SocialUsergetSocialUser(javax.servlet.http.HttpServletRequest request)protected StringgetState(ContentContext ctx)StringgetToken()abstract StringgetTokenEndpoint()StringgetURL()protected voidlogin(ContentContext ctx, SocialUser socialUser, boolean admin)voidperformRedirect(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean admin)voidprepare(ContentContext ctx)prepare social network for renderingvoidset(String key, String value)voidsetApiKey(String clientSecret)voidsetClientId(String clientId)voidsetClientSecret(String clientSecret)voidsetLogin(String login)voidsetRedirectURL(String redirectURL)voidsetToken(String token)voidsetURL(String url)voidupdate(Map map)update value with a map.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.javlo.service.social.ISocialNetwork
getName
-
-
-
-
Method Detail
-
prepare
public void prepare(ContentContext ctx) throws Exception
Description copied from interface:ISocialNetworkprepare social network for rendering- Specified by:
preparein interfaceISocialNetwork- Throws:
org.apache.oltu.oauth2.common.exception.OAuthSystemExceptionException
-
getToken
public String getToken()
- Specified by:
getTokenin interfaceISocialNetwork
-
getLogin
public String getLogin()
- Specified by:
getLoginin interfaceISocialNetwork
-
getURL
public String getURL()
- Specified by:
getURLin interfaceISocialNetwork
-
getData
public Map<String,String> getData()
- Specified by:
getDatain interfaceISocialNetwork
-
setToken
public void setToken(String token)
- Specified by:
setTokenin interfaceISocialNetwork
-
setURL
public void setURL(String url)
- Specified by:
setURLin interfaceISocialNetwork
-
setLogin
public void setLogin(String login)
- Specified by:
setLoginin interfaceISocialNetwork
-
set
public void set(String key, String value)
- Specified by:
setin interfaceISocialNetwork
-
update
public void update(Map map)
Description copied from interface:ISocialNetworkupdate value with a map.- Specified by:
updatein interfaceISocialNetwork
-
getClientId
public String getClientId()
- Specified by:
getClientIdin interfaceISocialNetwork
-
setClientId
public void setClientId(String clientId)
- Specified by:
setClientIdin interfaceISocialNetwork
-
getClientSecret
public String getClientSecret()
- Specified by:
getClientSecretin interfaceISocialNetwork
-
setClientSecret
public void setClientSecret(String clientSecret)
- Specified by:
setClientSecretin interfaceISocialNetwork
-
getApiKey
public String getApiKey()
- Specified by:
getApiKeyin interfaceISocialNetwork
-
setApiKey
public void setApiKey(String clientSecret)
- Specified by:
setApiKeyin interfaceISocialNetwork
-
getState
protected String getState(ContentContext ctx) throws Exception
- Throws:
Exception
-
getAuthzEndpoint
public abstract String getAuthzEndpoint()
-
getTokenEndpoint
public abstract String getTokenEndpoint()
-
getSigninURL
public String getSigninURL(ContentContext ctx, boolean popup) throws Exception
- Specified by:
getSigninURLin interfaceISocialNetwork- Throws:
Exception
-
createAuthenticationRequest
protected org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder createAuthenticationRequest()
-
configureAuthenticationRequest
protected void configureAuthenticationRequest(org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder builder, String clientId, ContentContext ctx, boolean popup) throws Exception- Throws:
Exception
-
buildAuthenticationRequest
protected org.apache.oltu.oauth2.client.request.OAuthClientRequest buildAuthenticationRequest(org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder builder) throws org.apache.oltu.oauth2.common.exception.OAuthSystemException- Throws:
org.apache.oltu.oauth2.common.exception.OAuthSystemException
-
getRedirectURL
public String getRedirectURL()
- Specified by:
getRedirectURLin interfaceISocialNetwork
-
setRedirectURL
public void setRedirectURL(String redirectURL)
- Specified by:
setRedirectURLin interfaceISocialNetwork
-
performRedirect
public void performRedirect(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean admin)- Specified by:
performRedirectin interfaceISocialNetwork
-
getSocialUser
public SocialUser getSocialUser(javax.servlet.http.HttpServletRequest request)
- Specified by:
getSocialUserin interfaceISocialNetwork
-
getAccessToken
public String getAccessToken(String code, org.apache.oltu.oauth2.client.OAuthClient oAuthClient) throws org.apache.oltu.oauth2.common.exception.OAuthSystemException, org.apache.oltu.oauth2.common.exception.OAuthProblemException
- Throws:
org.apache.oltu.oauth2.common.exception.OAuthSystemExceptionorg.apache.oltu.oauth2.common.exception.OAuthProblemException
-
executeTokenRequest
protected org.apache.oltu.oauth2.client.response.OAuthAccessTokenResponse executeTokenRequest(org.apache.oltu.oauth2.client.OAuthClient oAuthClient, org.apache.oltu.oauth2.client.request.OAuthClientRequest request) throws org.apache.oltu.oauth2.common.exception.OAuthSystemException, org.apache.oltu.oauth2.common.exception.OAuthProblemException- Throws:
org.apache.oltu.oauth2.common.exception.OAuthSystemExceptionorg.apache.oltu.oauth2.common.exception.OAuthProblemException
-
createTokenRequest
protected org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder createTokenRequest()
-
configureTokenRequest
protected void configureTokenRequest(org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder builder, String clientId, String clientSecret, String code)
-
buildTokenRequest
protected org.apache.oltu.oauth2.client.request.OAuthClientRequest buildTokenRequest(org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder builder) throws org.apache.oltu.oauth2.common.exception.OAuthSystemException- Throws:
org.apache.oltu.oauth2.common.exception.OAuthSystemException
-
getSocialUser
protected SocialUser getSocialUser(String accessToken, org.apache.oltu.oauth2.client.OAuthClient oAuthClient) throws Exception
- Throws:
Exception
-
login
protected void login(ContentContext ctx, SocialUser socialUser, boolean admin) throws UserAllreadyExistException, IOException
-
fillUserInfo
protected void fillUserInfo(UserInfo userInfo, SocialUser socialUser)
-
getLoginURL
public String getLoginURL()
-
-