You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2017/03/07 16:54:29 UTC

cxf git commit: Minor update to the abstract oauth2 provider

Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes b91bd2354 -> c4901706c


Minor update to the abstract oauth2 provider


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/c4901706
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c4901706
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c4901706

Branch: refs/heads/3.1.x-fixes
Commit: c4901706c4067791de8d34101d7d6d53a756639d
Parents: b91bd23
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Tue Mar 7 16:52:24 2017 +0000
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Tue Mar 7 16:53:37 2017 +0000

----------------------------------------------------------------------
 .../oauth2/provider/AbstractOAuthDataProvider.java        | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/c4901706/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/AbstractOAuthDataProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/AbstractOAuthDataProvider.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/AbstractOAuthDataProvider.java
index 5eb48ec..b360d62 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/AbstractOAuthDataProvider.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/AbstractOAuthDataProvider.java
@@ -249,9 +249,7 @@ public abstract class AbstractOAuthDataProvider implements OAuthDataProvider, Cl
     
     @Override
     public List<OAuthPermission> convertScopeToPermissions(Client client, List<String> requestedScopes) {
-        if (requiredScopes != null && !requestedScopes.containsAll(requiredScopes)) {
-            throw new OAuthServiceException("Required scopes are missing");
-        }
+        checkRequestedScopes(client, requestedScopes);
         if (requestedScopes.isEmpty()) {
             return Collections.emptyList();
         } else {
@@ -266,6 +264,12 @@ public abstract class AbstractOAuthDataProvider implements OAuthDataProvider, Cl
         throw new OAuthServiceException("Requested scopes can not be mapped");
         
     }
+    
+    protected void checkRequestedScopes(Client client, List<String> requestedScopes) {
+        if (requiredScopes != null && !requestedScopes.containsAll(requiredScopes)) {
+            throw new OAuthServiceException("Required scopes are missing");
+        }
+    }
 
     protected void convertSingleScopeToPermission(Client client, 
                                                   String scope,