Author: [email protected]
Date: Mon Oct 17 09:18:05 2011
New Revision: 1518

Log:
[AMDATUAUTH-101] Fixed updating tokens in the store after changing them

Modified:
   
trunk/amdatu-auth/oauth-server/src/main/java/org/amdatu/auth/oauth/server/service/OAuthTokenProviderImpl.java
   
trunk/amdatu-auth/oauth-server/src/main/java/org/amdatu/auth/oauth/server/servlet/OAuthAuthorizeTokenServletImpl.java
   
trunk/amdatu-auth/oauth-server/src/main/java/org/amdatu/auth/oauth/server/servlet/OAuthRequestTokenServletImpl.java
   trunk/amdatu-auth/test-integration/pom.xml

Modified: 
trunk/amdatu-auth/oauth-server/src/main/java/org/amdatu/auth/oauth/server/service/OAuthTokenProviderImpl.java
==============================================================================
--- 
trunk/amdatu-auth/oauth-server/src/main/java/org/amdatu/auth/oauth/server/service/OAuthTokenProviderImpl.java
       (original)
+++ 
trunk/amdatu-auth/oauth-server/src/main/java/org/amdatu/auth/oauth/server/service/OAuthTokenProviderImpl.java
       Mon Oct 17 09:18:05 2011
@@ -174,6 +174,7 @@
                     } else {
                         // Update the last used timestamp
                         
token.setProperty(OAuthTokenProvider.LAST_USED_TIMESTAMP_PROPERTY, new 
Long(System.currentTimeMillis()).toString());
+                        m_tokenStore.updateToken(token);
                     }
                 }
                 if (expired) {
@@ -229,6 +230,7 @@
         Token token = new Token(requestToken, tokenSecret, 
System.currentTimeMillis());
         token.setProperty(TOKEN_TYPE_PROPERTY, 
OAuthTokenProvider.REQUEST_TOKEN_TYPE);
         token.setProperty(CONSUMER_PROPERTY, consumer.consumerKey);
+        token.setProperty(CALLBACK_URL_PROPERTY, consumer.callbackURL);
         m_tokenStore.addToken(token);
         return token;
     }
@@ -238,6 +240,9 @@
             // Mark the token as authorized
             token.setProperty(OAuthTokenProvider.TOKEN_AUTHORIZED_PROPERTY, 
"true");
             token.setProperty(OAuthTokenProvider.USERID_PROPERTY, userId);
+            
+            // Update the token in the store
+            m_tokenStore.updateToken(token);
         } else {
             // Invalidate the token by removing it from the store
             m_tokenStore.removeToken(token);
@@ -247,6 +252,7 @@
     public String generateVerifier(Token token) throws OAuthException {
         String verifier = generateToken();
         token.setProperty(OAuthTokenProvider.VERIFIER_PROPERTY, verifier);
+        m_tokenStore.updateToken(token);
         return verifier;
     }
 

Modified: 
trunk/amdatu-auth/oauth-server/src/main/java/org/amdatu/auth/oauth/server/servlet/OAuthAuthorizeTokenServletImpl.java
==============================================================================
--- 
trunk/amdatu-auth/oauth-server/src/main/java/org/amdatu/auth/oauth/server/servlet/OAuthAuthorizeTokenServletImpl.java
       (original)
+++ 
trunk/amdatu-auth/oauth-server/src/main/java/org/amdatu/auth/oauth/server/servlet/OAuthAuthorizeTokenServletImpl.java
       Mon Oct 17 09:18:05 2011
@@ -137,17 +137,12 @@
     private void sendToAuthorizePage(final HttpServletRequest request, final 
HttpServletResponse response,
         final Token token, final OAuthConsumer consumer)
     throws IOException, ServletException {
-        String callback = request.getParameter(OAuth.OAUTH_CALLBACK);
-        if (callback == null || callback.length() <= 0) {
-            callback = "none";
-        }
         String consumerDescription = (String) consumer.getProperty("name");
         request.setAttribute("CONS_DESC", consumerDescription);
-        request.setAttribute("CALLBACK", callback);
         request.setAttribute("TOKEN", token.getToken());
         m_logService.log(LogService.LOG_DEBUG,
             "Forwarding authorize token request to " + 
m_serviceProvider.getAuthorizeTokenURL()
-            + ", token=" + token.getToken() + ", callback=" + callback);
+            + ", token=" + token.getToken() + ", callback=" + 
consumer.callbackURL);
 
         // Dispatch the request to the authorize JSP
         // The authorize URL

Modified: 
trunk/amdatu-auth/oauth-server/src/main/java/org/amdatu/auth/oauth/server/servlet/OAuthRequestTokenServletImpl.java
==============================================================================
--- 
trunk/amdatu-auth/oauth-server/src/main/java/org/amdatu/auth/oauth/server/servlet/OAuthRequestTokenServletImpl.java
 (original)
+++ 
trunk/amdatu-auth/oauth-server/src/main/java/org/amdatu/auth/oauth/server/servlet/OAuthRequestTokenServletImpl.java
 Mon Oct 17 09:18:05 2011
@@ -106,8 +106,6 @@
                 }
             }
             Token requestToken = 
m_tokenProvider.generateRequestToken(consumer);
-            requestToken.setProperty(OAuthTokenProvider.CALLBACK_URL_PROPERTY, 
callback);
-
             m_logService.log(LogService.LOG_DEBUG, "Request token '" + 
requestToken.getToken()
                 + "' generated for consumer '" + consumer.consumerKey + "'");
 

Modified: trunk/amdatu-auth/test-integration/pom.xml
==============================================================================
--- trunk/amdatu-auth/test-integration/pom.xml  (original)
+++ trunk/amdatu-auth/test-integration/pom.xml  Mon Oct 17 09:18:05 2011
@@ -27,8 +27,8 @@
   <name>Amdatu Auth - Integration Tests reactor</name>
 
   <properties>
-    <org.amdatu.core.version>0.2.1-SNAPSHOT</org.amdatu.core.version>
-    <org.amdatu.web.version>0.2.1-SNAPSHOT</org.amdatu.web.version>
+    <org.amdatu.core.version>0.2.1-RC1</org.amdatu.core.version>
+    <org.amdatu.web.version>0.2.1-RC1</org.amdatu.web.version>
     <org.apache.felix.http.version>2.2.0</org.apache.felix.http.version>
   </properties>
 
_______________________________________________
Amdatu-commits mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-commits

Reply via email to