public class GateInFacebookProcessorImpl extends Object implements GateInFacebookProcessor
| Constructor and Description |
|---|
GateInFacebookProcessorImpl(org.exoplatform.container.ExoContainerContext context,
org.exoplatform.container.xml.InitParams params,
SecureRandomService secureRandomService) |
| Modifier and Type | Method and Description |
|---|---|
FacebookAccessTokenContext |
getAccessTokenFromUserProfile(org.exoplatform.services.organization.UserProfile userProfile,
OAuthCodec codec)
Obtain needed data from given userProfile and create accessToken from them
|
<C> C |
getAuthorizedSocialApiObject(FacebookAccessTokenContext accessToken,
Class<C> socialApiObjectType)
Return object, which can be used to call some operations on this Social network.
|
String |
getAvatar(FacebookAccessTokenContext accessTokenContext) |
FacebookPrincipal |
getPrincipal(FacebookAccessTokenContext accessTokenContext)
Obtain informations about user from Facebook and wrap them into FacebookPrincipal object
|
InteractionState<FacebookAccessTokenContext> |
processOAuthInteraction(javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse)
Process OAuth workflow for this OAuth provider (social network).
|
InteractionState<FacebookAccessTokenContext> |
processOAuthInteraction(javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse,
String scope)
Possibility to create new OAuth interaction with custom scope (not just the scope which is provided in configuration of this OAuth processor)
|
protected InteractionState<FacebookAccessTokenContext> |
processOAuthInteractionImpl(javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse,
FacebookProcessor facebookProcessor) |
void |
removeAccessTokenFromUserProfile(org.exoplatform.services.organization.UserProfile userProfile)
Remove data about access token from this user profile
|
void |
revokeToken(FacebookAccessTokenContext accessToken)
Revoke given access token on OAuth provider side, so application is removed from list of supported applications for given user
|
void |
saveAccessTokenAttributesToUserProfile(org.exoplatform.services.organization.UserProfile userProfile,
OAuthCodec codec,
FacebookAccessTokenContext accessTokenContext)
Save accessToken data to given userProfile.
|
FacebookAccessTokenContext |
validateTokenAndUpdateScopes(FacebookAccessTokenContext accessToken)
Send request to OAuth Provider to validate if given access token is valid and ask for scopes, which are available for given accessToken.
|
public GateInFacebookProcessorImpl(org.exoplatform.container.ExoContainerContext context,
org.exoplatform.container.xml.InitParams params,
SecureRandomService secureRandomService)
public InteractionState<FacebookAccessTokenContext> processOAuthInteraction(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, String scope) throws IOException
OAuthProviderProcessorprocessOAuthInteraction in interface OAuthProviderProcessor<FacebookAccessTokenContext>scope - custom scope, which contains all scopes in single String divided by AccessTokenContext.DELIMITERIOException#processOAuthInteraction(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)}public InteractionState<FacebookAccessTokenContext> processOAuthInteraction(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) throws IOException
OAuthProviderProcessorInteractionState
is in state InteractionState.State.FINISH and in this case, InteractionState should also have accessToken filled.
If InteractionState is in state InteractionState.State.AUTH, then more redirections are needed. In this case,
given HttpServletResponse should be already committed and prepared for redirection.processOAuthInteraction in interface OAuthProviderProcessor<FacebookAccessTokenContext>IOException - if IO error occured (for example if httpResponse.sendRedirect failed)protected InteractionState<FacebookAccessTokenContext> processOAuthInteractionImpl(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, FacebookProcessor facebookProcessor) throws IOException
IOExceptionpublic FacebookPrincipal getPrincipal(FacebookAccessTokenContext accessTokenContext)
GateInFacebookProcessorgetPrincipal in interface GateInFacebookProcessoraccessTokenContext - Facebook access tokenpublic String getAvatar(FacebookAccessTokenContext accessTokenContext)
getAvatar in interface GateInFacebookProcessorpublic void saveAccessTokenAttributesToUserProfile(org.exoplatform.services.organization.UserProfile userProfile,
OAuthCodec codec,
FacebookAccessTokenContext accessTokenContext)
OAuthProviderProcessorsaveAccessTokenAttributesToUserProfile in interface OAuthProviderProcessor<FacebookAccessTokenContext>userProfile - where data about access token will be filledcodec - to encode some attributes (sensitive data) before save them to user profileaccessTokenContext - specific access token for this OAuth processorpublic FacebookAccessTokenContext getAccessTokenFromUserProfile(org.exoplatform.services.organization.UserProfile userProfile, OAuthCodec codec)
OAuthProviderProcessorgetAccessTokenFromUserProfile in interface OAuthProviderProcessor<FacebookAccessTokenContext>userProfile - where data from access token will be obtainedcodec - to decode data from userProfilepublic void removeAccessTokenFromUserProfile(org.exoplatform.services.organization.UserProfile userProfile)
OAuthProviderProcessorremoveAccessTokenFromUserProfile in interface OAuthProviderProcessor<FacebookAccessTokenContext>userProfile - from which data will be removedpublic void revokeToken(FacebookAccessTokenContext accessToken)
OAuthProviderProcessorrevokeToken in interface OAuthProviderProcessor<FacebookAccessTokenContext>accessToken - access token to revokepublic FacebookAccessTokenContext validateTokenAndUpdateScopes(FacebookAccessTokenContext accessToken) throws OAuthException
OAuthProviderProcessorvalidateTokenAndUpdateScopes in interface OAuthProviderProcessor<FacebookAccessTokenContext>accessToken - accessToken which will be used to ask OAuthProvider about validation and for available scopesOAuthException - usually with codes:
- OAuthExceptionCode.ACCESS_TOKEN_ERROR if invalid access is used as argument
- OAuthExceptionCode.IO_ERROR if IO error occurspublic <C> C getAuthorizedSocialApiObject(FacebookAccessTokenContext accessToken, Class<C> socialApiObjectType)
OAuthProviderProcessorgetAuthorizedSocialApiObject in interface OAuthProviderProcessor<FacebookAccessTokenContext>accessToken - access token used to initialize objectsocialApiObjectType - Type of object, which we wanted to return. Method will return null if this type is not supported by this processorCopyright © 2016 JBoss by Red Hat. All Rights Reserved.