Class ClusterableTokenStrategy

  • All Implemented Interfaces:
    OAuthIdentityTokenStrategy, org.eclipse.lyo.server.oauth.core.token.TokenStrategy

    public class ClusterableTokenStrategy
    extends Object
    implements OAuthIdentityTokenStrategy
    Default OAuthIdentityTokenStrategy implementation that is, depending on the CacheFactory implementation set by the application, able to work on cluster environments. Note: the default CacheFactory implementation is NOT cluster compatible, applications working in cluster environments MUST provide a cluster-compliant implementation.
    Since:
    3.3.0
    • Constructor Detail

      • ClusterableTokenStrategy

        public ClusterableTokenStrategy()
    • Method Detail

      • generateRequestToken

        public void generateRequestToken​(org.eclipse.lyo.server.oauth.core.OAuthRequest oAuthRequest)
                                  throws net.oauth.OAuthException,
                                         IOException
        Specified by:
        generateRequestToken in interface org.eclipse.lyo.server.oauth.core.token.TokenStrategy
        Throws:
        net.oauth.OAuthException
        IOException
      • validateRequestToken

        public String validateRequestToken​(HttpServletRequest httpRequest,
                                           net.oauth.OAuthMessage message)
                                    throws net.oauth.OAuthException,
                                           IOException
        Specified by:
        validateRequestToken in interface org.eclipse.lyo.server.oauth.core.token.TokenStrategy
        Throws:
        net.oauth.OAuthException
        IOException
      • getCallback

        public String getCallback​(HttpServletRequest httpRequest,
                                  String requestToken)
                           throws net.oauth.OAuthException
        Specified by:
        getCallback in interface org.eclipse.lyo.server.oauth.core.token.TokenStrategy
        Throws:
        net.oauth.OAuthException
      • markRequestTokenAuthorized

        public void markRequestTokenAuthorized​(HttpServletRequest httpRequest,
                                               String requestToken)
                                        throws net.oauth.OAuthException
        Specified by:
        markRequestTokenAuthorized in interface org.eclipse.lyo.server.oauth.core.token.TokenStrategy
        Throws:
        net.oauth.OAuthException
      • isRequestTokenAuthorized

        public boolean isRequestTokenAuthorized​(HttpServletRequest httpRequest,
                                                String requestToken)
                                         throws net.oauth.OAuthException
        Specified by:
        isRequestTokenAuthorized in interface org.eclipse.lyo.server.oauth.core.token.TokenStrategy
        Throws:
        net.oauth.OAuthException
      • generateVerificationCode

        public String generateVerificationCode​(HttpServletRequest httpRequest,
                                               String requestToken)
                                        throws net.oauth.OAuthException
        Specified by:
        generateVerificationCode in interface org.eclipse.lyo.server.oauth.core.token.TokenStrategy
        Throws:
        net.oauth.OAuthException
      • validateVerificationCode

        public void validateVerificationCode​(org.eclipse.lyo.server.oauth.core.OAuthRequest oAuthRequest)
                                      throws net.oauth.OAuthException,
                                             IOException
        Specified by:
        validateVerificationCode in interface org.eclipse.lyo.server.oauth.core.token.TokenStrategy
        Throws:
        net.oauth.OAuthException
        IOException
      • generateAccessToken

        public void generateAccessToken​(org.eclipse.lyo.server.oauth.core.OAuthRequest oAuthRequest)
                                 throws net.oauth.OAuthException,
                                        IOException
        Specified by:
        generateAccessToken in interface org.eclipse.lyo.server.oauth.core.token.TokenStrategy
        Throws:
        net.oauth.OAuthException
        IOException
      • validateAccessToken

        public void validateAccessToken​(org.eclipse.lyo.server.oauth.core.OAuthRequest oAuthRequest)
                                 throws net.oauth.OAuthException,
                                        IOException
        Specified by:
        validateAccessToken in interface org.eclipse.lyo.server.oauth.core.token.TokenStrategy
        Throws:
        net.oauth.OAuthException
        IOException
      • getTokenSecret

        public String getTokenSecret​(HttpServletRequest httpRequest,
                                     String token)
                              throws net.oauth.OAuthException
        Specified by:
        getTokenSecret in interface org.eclipse.lyo.server.oauth.core.token.TokenStrategy
        Throws:
        net.oauth.OAuthException
      • getOAuthIdentity

        public OAuthIdentity getOAuthIdentity​(String oauthToken)
        Description copied from interface: OAuthIdentityTokenStrategy
        Gets the OAuthIdentity associated with an access/request token. Implementations must catch (and cache) this identity during the OAuth dance.
        Specified by:
        getOAuthIdentity in interface OAuthIdentityTokenStrategy
        Parameters:
        oauthToken - the access or request token key.
        Returns:
        the associated identity if found, null otherwise.
      • setTwoLeggedOAuthIdentity

        public void setTwoLeggedOAuthIdentity​(String consumerKey,
                                              OAuthIdentity identity)
        Description copied from interface: OAuthIdentityTokenStrategy
        Convenient method to associate an OAuthIdentity with a consumer after a two-legged authentication. Since no end-user is involved in two-legged authentication requests, this method allows associating the consumer with the OAuthIdentity of the corresponding functional user once is resolved; subsequent requests can call then the OAuthIdentityTokenStrategy.getTwoLeggedOAuthIdentity(String) method to get the OAuthIdentity of the consumer without having to resolve it again.
        Specified by:
        setTwoLeggedOAuthIdentity in interface OAuthIdentityTokenStrategy
        Parameters:
        consumerKey - the consumer key.
        identity - the identity of the consumer's functional user.