org.exoplatform.ws.security.oauth.impl
Class OAuthProviderServiceImpl

java.lang.Object
  extended by org.exoplatform.ws.security.oauth.impl.OAuthProviderServiceImpl
All Implemented Interfaces:
OAuthProviderService
Direct Known Subclasses:
OAuthProviderServiceMD5Impl

public abstract class OAuthProviderServiceImpl
extends Object
implements OAuthProviderService

Version:
$Id: $
Author:
Andrey Parfonov

Field Summary
protected  HashMap<String,net.oauth.OAuthConsumer> consumers
          Known consumers.
protected static org.apache.commons.logging.Log LOG
          Logger.
protected  HashSet<net.oauth.OAuthAccessor> tokens
          User tokens.
 
Constructor Summary
OAuthProviderServiceImpl(org.exoplatform.container.xml.InitParams params)
          Constructs instance of OAuthProviderService.
 
Method Summary
 void authorize(net.oauth.OAuthAccessor accessor, String userId)
          
 void generateAccessToken(net.oauth.OAuthAccessor accessor)
          Generate access token for given accessor and remove it from collection.
 void generateRequestToken(net.oauth.OAuthAccessor accessor)
          Generate request token for given accessor and put it in collection.
protected abstract  String generateSecret()
          Generate secret token.
protected abstract  String generateToken()
          Generate token.
 net.oauth.OAuthAccessor getAccessor(net.oauth.OAuthMessage oauthMessage)
          Look up accessor by given OAuthMessage.
 net.oauth.OAuthConsumer getConsumer(net.oauth.OAuthMessage oauthMessage)
          
 net.oauth.OAuthConsumer getConsumer(String name)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

consumers

protected final HashMap<String,net.oauth.OAuthConsumer> consumers
Known consumers.


tokens

protected final HashSet<net.oauth.OAuthAccessor> tokens
User tokens. Tokens keeps in this Set only before user get access token.


LOG

protected static final org.apache.commons.logging.Log LOG
Logger.

Constructor Detail

OAuthProviderServiceImpl

public OAuthProviderServiceImpl(org.exoplatform.container.xml.InitParams params)
Constructs instance of OAuthProviderService.

Parameters:
params - the initialized parameters.
Method Detail

getConsumer

public net.oauth.OAuthConsumer getConsumer(String name)
                                    throws net.oauth.OAuthProblemException

Specified by:
getConsumer in interface OAuthProviderService
Parameters:
name - the consumer name.
Returns:
consumer.
Throws:
net.oauth.OAuthProblemException - if consumer not found.

getAccessor

public net.oauth.OAuthAccessor getAccessor(net.oauth.OAuthMessage oauthMessage)
                                    throws net.oauth.OAuthProblemException
Look up accessor by given OAuthMessage.

Specified by:
getAccessor in interface OAuthProviderService
Parameters:
oauthMessage - the message.
Returns:
OAuthAccessor.
Throws:
net.oauth.OAuthProblemException - if accessor not found.

getConsumer

public net.oauth.OAuthConsumer getConsumer(net.oauth.OAuthMessage oauthMessage)
                                    throws net.oauth.OAuthProblemException

Specified by:
getConsumer in interface OAuthProviderService
Parameters:
oauthMessage - the message.
Returns:
consumer.
Throws:
net.oauth.OAuthProblemException - if consumer not found.

authorize

public void authorize(net.oauth.OAuthAccessor accessor,
                      String userId)
               throws net.oauth.OAuthProblemException

Specified by:
authorize in interface OAuthProviderService
Parameters:
accessor - the accessor.
userId - the user name or other identifier.
Throws:
net.oauth.OAuthProblemException - if any error occurs.

generateRequestToken

public void generateRequestToken(net.oauth.OAuthAccessor accessor)
Generate request token for given accessor and put it in collection. After that it will be used for getting access token.

Specified by:
generateRequestToken in interface OAuthProviderService
Parameters:
accessor - the accessor.

generateAccessToken

public void generateAccessToken(net.oauth.OAuthAccessor accessor)
                         throws net.oauth.OAuthProblemException
Generate access token for given accessor and remove it from collection. This accessor must be kept by Consumer.

Specified by:
generateAccessToken in interface OAuthProviderService
Parameters:
accessor - the accessor.
Throws:
net.oauth.OAuthProblemException - if access token can't be created.

generateToken

protected abstract String generateToken()
Generate token.

Returns:
the token.

generateSecret

protected abstract String generateSecret()
Generate secret token.

Returns:
the created secret token.


Copyright © 2009 eXo Platform SAS. All Rights Reserved.