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: Some cleanup to do with populating OidcUserSubject
Date Wed, 09 Dec 2015 10:12:46 GMT
Repository: cxf-fediz
Updated Branches:
  refs/heads/master a5bafcdfd -> 807c00235


Some cleanup to do with populating OidcUserSubject


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

Branch: refs/heads/master
Commit: 807c002357b27d45d6904c45ad4d200ef8655ac8
Parents: a5bafcd
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Wed Dec 9 10:12:10 2015 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Wed Dec 9 10:12:10 2015 +0000

----------------------------------------------------------------------
 .../cxf/fediz/service/oidc/OAuthDataManager.java  | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/807c0023/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 9bb58eb..5c373b4 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
@@ -50,9 +50,7 @@ public class OAuthDataManager extends DefaultEHCacheCodeDataProvider {
         OidcUserSubject oidcSub = createOidcSubject(grant.getClient(), 
                                                     grant.getSubject(), 
                                                     reg.getNonce());
-        if (oidcSub != null) {
-            grant.setSubject(oidcSub);
-        }
+        grant.setSubject(oidcSub);
         return grant;
     }
     
@@ -60,12 +58,11 @@ public class OAuthDataManager extends DefaultEHCacheCodeDataProvider {
     protected ServerAccessToken doCreateAccessToken(AccessTokenRegistration reg)
         throws OAuthServiceException {
         ServerAccessToken token = super.doCreateAccessToken(reg);
-        OidcUserSubject oidcSub = null;
-        if (!(token.getSubject() instanceof OidcUserSubject)) {
-            oidcSub = createOidcSubject(token.getClient(), token.getSubject(), reg.getNonce());
-            if (oidcSub != null) {
-                token.setSubject(oidcSub);
-            }
+        if (OAuthConstants.IMPLICIT_GRANT.equals(reg.getGrantType())) {
+            OidcUserSubject oidcSub = createOidcSubject(token.getClient(), 
+                                                        token.getSubject(), 
+                                                        reg.getNonce());
+            token.setSubject(oidcSub);
         }
         return token;
     }
@@ -98,8 +95,9 @@ public class OAuthDataManager extends DefaultEHCacheCodeDataProvider {
                                                    fedizPrincipal.getClaims(),
                                                    client.getClientId(),
                                                    nonce);
+        } else {
+            throw new OAuthServiceException("Unsupported Principal");
         }
-        return null;
     }
 
     public void setTokenConverter(SamlTokenConverter tokenConverter) {


Mime
View raw message