cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf-fediz git commit: [FEDIZ-134] Making it simpler to extend the default data manager
Date Wed, 11 Nov 2015 11:12:50 GMT
Repository: cxf-fediz
Updated Branches:
  refs/heads/master 9a67fbacb -> 6d7bc5f9e


[FEDIZ-134] Making it simpler to extend the default data manager


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

Branch: refs/heads/master
Commit: 6d7bc5f9ea1fc4d3734b8dddff9bd46cc81e16da
Parents: 9a67fba
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Wed Nov 11 11:12:35 2015 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Wed Nov 11 11:12:35 2015 +0000

----------------------------------------------------------------------
 .../fediz/service/oidc/OAuthDataManager.java    | 21 ++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/6d7bc5f9/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/OAuthDataManager.java
----------------------------------------------------------------------
diff --git a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/OAuthDataManager.java
b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/OAuthDataManager.java
index 810cfa0..c00197d 100644
--- a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/OAuthDataManager.java
+++ b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/OAuthDataManager.java
@@ -57,11 +57,17 @@ public class OAuthDataManager extends AbstractCodeDataProvider {
     private Map<String, RefreshToken> refreshTokens = new ConcurrentHashMap<String,
RefreshToken>();
     private Map<String, ServerAuthorizationCodeGrant> codeGrants = 
             new ConcurrentHashMap<String, ServerAuthorizationCodeGrant>();
-
+    
+    
+    
     public OAuthDataManager() {
         permissionMap.put(OPENID_PERMISSION.getPermission(), OPENID_PERMISSION);
     }
     
+    public OAuthDataManager(Map<String, OAuthPermission> permissionMap) {
+        this.permissionMap = permissionMap;
+    }
+    
     public void registerClient(Client c) {
         clients.put(c.getClientId(), c);
     }
@@ -82,12 +88,15 @@ public class OAuthDataManager extends AbstractCodeDataProvider {
         } else {
             throw new OAuthServiceException("Unsupported principal");
         }
-        
-        codeGrants.put(grant.getCode(), grant);
+        doSaveCodeGrant(grant);
+    }
 
+    protected void doSaveCodeGrant(ServerAuthorizationCodeGrant grant) {
+        codeGrants.put(grant.getCode(), grant);
+        
     }
 
-    private String getJoseIdToken(FedizPrincipal principal, String clientId) {
+    protected String getJoseIdToken(FedizPrincipal principal, String clientId) {
         IdToken jwtClaims = tokenConverter.convertToIdToken(principal.getLoginToken().getOwnerDocument(),
                                                           principal.getName(), 
                                                           clientId);
@@ -158,8 +167,8 @@ public class OAuthDataManager extends AbstractCodeDataProvider {
         this.tokenConverter = tokenConverter;
     }
 
-    public void setScopes(Map<String, String> extraScopes) {
-        for (Map.Entry<String, String> entry : extraScopes.entrySet()) {
+    public void setScopes(Map<String, String> scopes) {
+        for (Map.Entry<String, String> entry : scopes.entrySet()) {
             OAuthPermission permission = new OAuthPermission(entry.getKey(), entry.getValue());
             if (OidcUtils.OPENID_SCOPE.equals(entry.getKey())) {
                 permission.setDefault(true);


Mime
View raw message