cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1234739 - 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 10:59:45 GMT
Author: sergeyb
Date: Mon Jan 23 10:59:44 2012
New Revision: 1234739

URL: http://svn.apache.org/viewvc?rev=1234739&view=rev
Log:
[CXF-4051] Removing redundant OAuthDataProvider.getPermissionsInfo

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/data/Client.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/data/Token.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/filters/AbstractAuthFilter.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/AuthorizationRequestHandler.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/utils/OAuthUtils.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=1234739&r1=1234738&r2=1234739&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 10:59:44 2012
@@ -74,7 +74,7 @@ public class MemoryOAuthDataProvider imp
         clientAuthInfo.put(CLIENT_ID, client);
     }
     
-    public List<OAuthPermission> getPermissionsInfo(List<String> requestPermissions)
{
+    private List<OAuthPermission> getPermissionsInfo(List<String> requestPermissions)
{
         List<OAuthPermission> permissions = new ArrayList<OAuthPermission>();
         for (String requestScope : requestPermissions) {
             OAuthPermission oAuthPermission = AVAILABLE_PERMISSIONS.get(requestScope);
@@ -94,7 +94,7 @@ public class MemoryOAuthDataProvider imp
 
         RequestToken reqToken = new RequestToken(reg.getClient(), token, tokenSecret, 
                                                  reg.getLifetime(), reg.getIssuedAt());
-        reqToken.setScopes(reg.getScopes());
+        reqToken.setScopes(getPermissionsInfo(reg.getScopes()));
         reqToken.setUris(reg.getUris());
         reqToken.setCallback(reg.getCallback());
         oauthTokens.put(token, reqToken);

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=1234739&r1=1234738&r2=1234739&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 10:59:44 2012
@@ -70,7 +70,7 @@ public class MemoryOAuthDataProvider imp
         clientAuthInfo.put(OAuthTestUtils.CLIENT_ID, client);
     }
     
-    public List<OAuthPermission> getPermissionsInfo(List<String> requestPermissions)
{
+    private List<OAuthPermission> getPermissionsInfo(List<String> requestPermissions)
{
         List<OAuthPermission> permissions = new ArrayList<OAuthPermission>();
         for (String requestScope : requestPermissions) {
             OAuthPermission oAuthPermission = AVAILABLE_PERMISSIONS.get(requestScope);
@@ -90,7 +90,7 @@ public class MemoryOAuthDataProvider imp
 
         RequestToken reqToken = new RequestToken(reg.getClient(), token, tokenSecret, 
                                                  reg.getLifetime(), reg.getIssuedAt());
-        reqToken.setScopes(reg.getScopes());
+        reqToken.setScopes(getPermissionsInfo(reg.getScopes()));
         reqToken.setUris(reg.getUris());
         
         oauthTokens.put(token, reqToken);

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/data/Client.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/data/Client.java?rev=1234739&r1=1234738&r2=1234739&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/data/Client.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/data/Client.java
Mon Jan 23 10:59:44 2012
@@ -32,7 +32,7 @@ public class Client {
     private String loginName;
         
     private List<String> uris = Collections.emptyList();
-    private List<String> scopes = Collections.emptyList();
+    private List<OAuthPermission> scopes = Collections.emptyList();
 
     public Client(String consumerId, 
                   String secretKey,
@@ -120,7 +120,7 @@ public class Client {
      * Returns a list of opaque permissions/scopes
      * @return the scopes
      */
-    public List<String> getScopes() {
+    public List<OAuthPermission> getScopes() {
         return scopes;
     }
 
@@ -128,7 +128,7 @@ public class Client {
      * Sets a list of opaque permissions/scopes
      * @param scopes the scopes
      */
-    public void setScopes(List<String> scopes) {
+    public void setScopes(List<OAuthPermission> scopes) {
         this.scopes = scopes;
     }
     

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/data/Token.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/data/Token.java?rev=1234739&r1=1234738&r2=1234739&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/data/Token.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/data/Token.java
Mon Jan 23 10:59:44 2012
@@ -31,7 +31,7 @@ public abstract class Token {
     private long issuedAt = -1;
     private long lifetime = -1;
     private Client client;
-    private List<String> scopes = Collections.emptyList();
+    private List<OAuthPermission> scopes = Collections.emptyList();
     private List<String> uris = Collections.emptyList();
     private UserSubject subject;
     
@@ -88,7 +88,7 @@ public abstract class Token {
      * Returns a list of opaque permissions/scopes
      * @return the scopes
      */
-    public List<String> getScopes() {
+    public List<OAuthPermission> getScopes() {
         return scopes;
     }
 
@@ -96,7 +96,7 @@ public abstract class Token {
      * Sets a list of opaque permissions/scopes
      * @param scopes the scopes
      */
-    public void setScopes(List<String> scopes) {
+    public void setScopes(List<OAuthPermission> scopes) {
         this.scopes = scopes;
     }
     

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/filters/AbstractAuthFilter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/filters/AbstractAuthFilter.java?rev=1234739&r1=1234738&r2=1234739&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/filters/AbstractAuthFilter.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/filters/AbstractAuthFilter.java
Mon Jan 23 10:59:44 2012
@@ -137,8 +137,7 @@ public class AbstractAuthFilter {
         //check valid URI
         checkRequestURI(req, OAuthUtils.getAllUris(client, accessToken));
         
-        List<OAuthPermission> permissions = dataProvider.getPermissionsInfo(
-                OAuthUtils.getAllScopes(client, accessToken));
+        List<OAuthPermission> permissions = OAuthUtils.getAllScopes(client, accessToken);
         
         for (OAuthPermission perm : permissions) {
             checkRequestURI(req, perm.getUris());

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=1234739&r1=1234738&r2=1234739&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 10:59:44 2012
@@ -19,11 +19,8 @@
 
 package org.apache.cxf.rs.security.oauth.provider;
 
-import java.util.List;
-
 import org.apache.cxf.rs.security.oauth.data.AccessToken;
 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;
 import org.apache.cxf.rs.security.oauth.data.RequestTokenRegistration;
 import org.apache.cxf.rs.security.oauth.data.Token;
@@ -97,12 +94,4 @@ public interface OAuthDataProvider {
      */
     void removeToken(Token token) throws OAuthServiceException;
     
-    /**
-     * Returns the list of {@link OAuthPermission} beans describing opaque
-     * permissions (aka scopes) such as "read_data", etc
-     * @param requestPermissions the list of opaque scopes/permissions 
-     * @see OAuthPermission 
-     * @return permissions
-     */
-    List<OAuthPermission> getPermissionsInfo(List<String> requestPermissions);
 }

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/services/AuthorizationRequestHandler.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/AuthorizationRequestHandler.java?rev=1234739&r1=1234738&r2=1234739&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/services/AuthorizationRequestHandler.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/services/AuthorizationRequestHandler.java
Mon Jan 23 10:59:44 2012
@@ -156,8 +156,7 @@ public class AuthorizationRequestHandler
         secData.setApplicationName(token.getClient().getApplicationName()); 
         secData.setApplicationURI(token.getClient().getApplicationURI());
         
-        secData.setPermissions(
-                dataProvider.getPermissionsInfo(OAuthUtils.getAllScopes(token.getClient(),
token)));
+        secData.setPermissions(OAuthUtils.getAllScopes(token.getClient(), token));
         secData.setUris(OAuthUtils.getAllUris(token.getClient(), token));
         
         return secData;

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/utils/OAuthUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/utils/OAuthUtils.java?rev=1234739&r1=1234738&r2=1234739&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/utils/OAuthUtils.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/utils/OAuthUtils.java
Mon Jan 23 10:59:44 2012
@@ -51,6 +51,7 @@ import org.apache.cxf.jaxrs.impl.Metadat
 import org.apache.cxf.jaxrs.model.URITemplate;
 import org.apache.cxf.jaxrs.utils.FormUtils;
 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;
 import org.apache.cxf.rs.security.oauth.data.Token;
 import org.apache.cxf.rs.security.oauth.provider.DefaultOAuthValidator;
@@ -82,8 +83,8 @@ public final class OAuthUtils {
         return false;
     }
     
-    public static List<String> getAllScopes(Client client, Token token) {
-        List<String> scopes = new LinkedList<String>();
+    public static List<OAuthPermission> getAllScopes(Client client, Token token) {
+        List<OAuthPermission> scopes = new LinkedList<OAuthPermission>();
         if (token != null) {
             scopes.addAll(token.getScopes());
         }



Mime
View raw message