cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1234756 - in /cxf/trunk: distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/controllers/ rt/rs/security/oauth-parent/oauth-test/src/main/java/org/apache/cxf/rs/security/oauth/test/ rt/rs/security/oauth-paren...
Date Mon, 23 Jan 2012 12:01:48 GMT
Author: sergeyb
Date: Mon Jan 23 12:01:48 2012
New Revision: 1234756

URL: http://svn.apache.org/viewvc?rev=1234756&view=rev
Log:
[CXF-4051] And making the AccessToken registration more flexible

Modified:
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/controllers/MemoryOAuthDataProvider.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth-test/src/main/java/org/apache/cxf/rs/security/oauth/test/MemoryOAuthDataProvider.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/provider/OAuthDataProvider.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/services/AccessTokenHandler.java

Modified: cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/controllers/MemoryOAuthDataProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/controllers/MemoryOAuthDataProvider.java?rev=1234756&r1=1234755&r2=1234756&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/controllers/MemoryOAuthDataProvider.java
(original)
+++ cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/controllers/MemoryOAuthDataProvider.java
Mon Jan 23 12:01:48 2012
@@ -31,6 +31,7 @@ import net.oauth.OAuthProblemException;
 
 import org.apache.cxf.jaxrs.impl.MetadataMap;
 import org.apache.cxf.rs.security.oauth.data.AccessToken;
+import org.apache.cxf.rs.security.oauth.data.AccessTokenRegistration;
 import org.apache.cxf.rs.security.oauth.data.Client;
 import org.apache.cxf.rs.security.oauth.data.OAuthPermission;
 import org.apache.cxf.rs.security.oauth.data.RequestToken;
@@ -116,8 +117,10 @@ public class MemoryOAuthDataProvider imp
         return requestToken.getVerifier();
     }
 
-    public AccessToken createAccessToken(RequestToken requestToken) throws
-            OAuthServiceException {
+    public AccessToken createAccessToken(AccessTokenRegistration reg) throws
+        OAuthServiceException {
+
+        RequestToken requestToken = reg.getRequestToken();
 
         Client client = requestToken.getClient();
         requestToken = getRequestToken(requestToken.getTokenKey());

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth-test/src/main/java/org/apache/cxf/rs/security/oauth/test/MemoryOAuthDataProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth-test/src/main/java/org/apache/cxf/rs/security/oauth/test/MemoryOAuthDataProvider.java?rev=1234756&r1=1234755&r2=1234756&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth-test/src/main/java/org/apache/cxf/rs/security/oauth/test/MemoryOAuthDataProvider.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth-test/src/main/java/org/apache/cxf/rs/security/oauth/test/MemoryOAuthDataProvider.java
Mon Jan 23 12:01:48 2012
@@ -28,6 +28,7 @@ import java.util.concurrent.ConcurrentHa
 
 import org.apache.cxf.jaxrs.impl.MetadataMap;
 import org.apache.cxf.rs.security.oauth.data.AccessToken;
+import org.apache.cxf.rs.security.oauth.data.AccessTokenRegistration;
 import org.apache.cxf.rs.security.oauth.data.Client;
 import org.apache.cxf.rs.security.oauth.data.OAuthPermission;
 import org.apache.cxf.rs.security.oauth.data.RequestToken;
@@ -108,9 +109,11 @@ public class MemoryOAuthDataProvider imp
         return requestToken.getVerifier();
     }
 
-    public AccessToken createAccessToken(RequestToken requestToken) throws
+    public AccessToken createAccessToken(AccessTokenRegistration reg) throws
             OAuthServiceException {
 
+        RequestToken requestToken = reg.getRequestToken();
+        
         Client client = requestToken.getClient();
         requestToken = getRequestToken(requestToken.getTokenKey());
 

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/provider/OAuthDataProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/provider/OAuthDataProvider.java?rev=1234756&r1=1234755&r2=1234756&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/provider/OAuthDataProvider.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/provider/OAuthDataProvider.java
Mon Jan 23 12:01:48 2012
@@ -20,6 +20,7 @@
 package org.apache.cxf.rs.security.oauth.provider;
 
 import org.apache.cxf.rs.security.oauth.data.AccessToken;
+import org.apache.cxf.rs.security.oauth.data.AccessTokenRegistration;
 import org.apache.cxf.rs.security.oauth.data.Client;
 import org.apache.cxf.rs.security.oauth.data.RequestToken;
 import org.apache.cxf.rs.security.oauth.data.RequestTokenRegistration;
@@ -73,11 +74,12 @@ public interface OAuthDataProvider {
     
     /**
      * Creates a new {@link AccessToken}
-     * @param requestToken the request token approved by the resource owner
+     * @param reg {@link AccessTokenRegistration} instance which captures 
+     *        a request token approved by the resource owner
      * @return new AccessToken
      * @throws OAuthServiceException
      */
-    AccessToken createAccessToken(RequestToken requestToken) throws OAuthServiceException;
+    AccessToken createAccessToken(AccessTokenRegistration reg) throws OAuthServiceException;
 
     /**
      * Returns the {@link AccessToken}

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/services/AccessTokenHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/services/AccessTokenHandler.java?rev=1234756&r1=1234755&r2=1234756&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/services/AccessTokenHandler.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/services/AccessTokenHandler.java
Mon Jan 23 12:01:48 2012
@@ -33,6 +33,7 @@ import net.oauth.OAuthProblemException;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.jaxrs.ext.MessageContext;
 import org.apache.cxf.rs.security.oauth.data.AccessToken;
+import org.apache.cxf.rs.security.oauth.data.AccessTokenRegistration;
 import org.apache.cxf.rs.security.oauth.data.RequestToken;
 import org.apache.cxf.rs.security.oauth.provider.OAuthDataProvider;
 import org.apache.cxf.rs.security.oauth.utils.OAuthConstants;
@@ -70,7 +71,9 @@ public class AccessTokenHandler {
             OAuthUtils.validateMessage(oAuthMessage, requestToken.getClient(), requestToken,
                                        dataProvider);
 
-            AccessToken accessToken = dataProvider.createAccessToken(requestToken);
+            AccessTokenRegistration reg = new AccessTokenRegistration();
+            reg.setRequestToken(requestToken);
+            AccessToken accessToken = dataProvider.createAccessToken(reg);
 
             //create response
             Map<String, Object> responseParams = new HashMap<String, Object>();



Mime
View raw message