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 2016/01/19 12:52:51 UTC

cxf git commit: Minor update to the oauth2 provider

Repository: cxf
Updated Branches:
  refs/heads/master f11ec01ac -> 7198fd782


Minor update to the oauth2 provider


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

Branch: refs/heads/master
Commit: 7198fd782e7d7a9aaf94a2d18c4ff23e9fb626b1
Parents: f11ec01
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Tue Jan 19 11:52:34 2016 +0000
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Tue Jan 19 11:52:34 2016 +0000

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


http://git-wip-us.apache.org/repos/asf/cxf/blob/7198fd78/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 38e1845..6dfda96 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
@@ -154,13 +154,12 @@ 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");
+        }
         if (requestedScopes.isEmpty()) {
             return Collections.emptyList();
         } else if (!permissionMap.isEmpty()) {
-            if (requiredScopes != null && !requestedScopes.containsAll(requiredScopes)) {
-                throw new OAuthServiceException("Required scopes are missing");
-            }
-            
             List<OAuthPermission> list = new ArrayList<OAuthPermission>();
             for (String scope : requestedScopes) {
                 OAuthPermission permission = permissionMap.get(scope);