cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Minor update to the abstract grant handler
Date Thu, 09 Mar 2017 16:38:40 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes c866412a8 -> a0609adf1


Minor update to the abstract grant handler

Conflicts:
	rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/AbstractGrantHandler.java


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

Branch: refs/heads/3.1.x-fixes
Commit: a0609adf1ebb6eb80d4f48f76c7cdee5d075a93c
Parents: c866412
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Thu Mar 9 16:24:39 2017 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Thu Mar 9 16:37:59 2017 +0000

----------------------------------------------------------------------
 .../rs/security/oauth2/grants/AbstractGrantHandler.java   | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/a0609adf/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/AbstractGrantHandler.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/AbstractGrantHandler.java
b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/AbstractGrantHandler.java
index d00cd30..afe2ba6 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/AbstractGrantHandler.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/AbstractGrantHandler.java
@@ -143,12 +143,16 @@ public abstract class AbstractGrantHandler implements AccessTokenGrantHandler
{
         reg.setGrantType(requestedGrant);
         reg.setSubject(subject);
         reg.setRequestedScope(requestedScopes);
-        List<String> scopes = Collections.emptyList();
-        reg.setApprovedScope(scopes);
+        reg.setApprovedScope(getApprovedScopes(client, subject, requestedScopes));
         reg.setAudiences(audiences);
         return dataProvider.createAccessToken(reg);
     }
-    
+
+    protected List<String> getApprovedScopes(Client client, UserSubject subject, List<String>
requestedScopes) {
+        // This method can be overridden if the down-scoping is required 
+        return Collections.emptyList();
+    }
+
     protected ServerAccessToken getPreAuthorizedToken(Client client,
                                                       UserSubject subject,
                                                       String requestedGrant,


Mime
View raw message