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 token converter interface more IdToken type friendly
Date Wed, 11 Nov 2015 11:01:32 GMT
Repository: cxf-fediz
Updated Branches:
  refs/heads/master be1904a44 -> 9a67fbacb


[FEDIZ-134] Making token converter interface more IdToken type friendly


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

Branch: refs/heads/master
Commit: 9a67fbacbccf8315bfd8f1fb5242f0b8c523b1ff
Parents: be1904a
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Wed Nov 11 11:01:13 2015 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Wed Nov 11 11:01:13 2015 +0000

----------------------------------------------------------------------
 .../service/oidc/LocalSamlTokenConverter.java   | 22 ++++++++++----------
 .../fediz/service/oidc/OAuthDataManager.java    |  4 ++--
 .../fediz/service/oidc/SamlTokenConverter.java  |  9 ++++----
 3 files changed, 18 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/9a67fbac/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/LocalSamlTokenConverter.java
----------------------------------------------------------------------
diff --git a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/LocalSamlTokenConverter.java
b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/LocalSamlTokenConverter.java
index 7644b47..3f9443d 100644
--- a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/LocalSamlTokenConverter.java
+++ b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/LocalSamlTokenConverter.java
@@ -19,21 +19,21 @@
 package org.apache.cxf.fediz.service.oidc;
 
 import org.w3c.dom.Document;
-import org.apache.cxf.rs.security.jose.jwt.JwtClaims;
+import org.apache.cxf.rs.security.oidc.common.IdToken;
+
+
 
 public class LocalSamlTokenConverter implements SamlTokenConverter {
 
     @Override
-    public JwtClaims convertToJwt(Document samlDoc, 
-                                  String subjectName,
-                                  String audience) {
-        JwtClaims claims = new JwtClaims();
-        claims.setSubject(subjectName);
-        claims.setAudience(audience);
-        claims.setIssuer("accounts.fediz.com");
-        claims.setIssuedAt(System.currentTimeMillis() / 1000);
-        claims.setExpiryTime(System.currentTimeMillis() / 1000 + 60000);
-        return claims;
+    public IdToken convertToIdToken(Document samlDoc, String subjectName, String clientId)
{
+        IdToken idToken = new IdToken();
+        idToken.setSubject(subjectName);
+        idToken.setAudience(clientId);
+        idToken.setIssuer("accounts.fediz.com");
+        idToken.setIssuedAt(System.currentTimeMillis() / 1000);
+        idToken.setExpiryTime(System.currentTimeMillis() / 1000 + 60000);
+        return idToken;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/9a67fbac/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 15ead2c..810cfa0 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
@@ -29,7 +29,6 @@ import org.apache.cxf.fediz.core.FedizPrincipal;
 import org.apache.cxf.jaxrs.ext.MessageContext;
 import org.apache.cxf.rs.security.jose.jws.JwsJwtCompactProducer;
 import org.apache.cxf.rs.security.jose.jws.NoneJwsSignatureProvider;
-import org.apache.cxf.rs.security.jose.jwt.JwtClaims;
 import org.apache.cxf.rs.security.oauth2.common.Client;
 import org.apache.cxf.rs.security.oauth2.common.OAuthPermission;
 import org.apache.cxf.rs.security.oauth2.common.ServerAccessToken;
@@ -38,6 +37,7 @@ import org.apache.cxf.rs.security.oauth2.grants.code.ServerAuthorizationCodeGran
 import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
 import org.apache.cxf.rs.security.oauth2.tokens.refresh.RefreshToken;
 import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
+import org.apache.cxf.rs.security.oidc.common.IdToken;
 import org.apache.cxf.rs.security.oidc.utils.OidcUtils;
 
 public class OAuthDataManager extends AbstractCodeDataProvider {
@@ -88,7 +88,7 @@ public class OAuthDataManager extends AbstractCodeDataProvider {
     }
 
     private String getJoseIdToken(FedizPrincipal principal, String clientId) {
-        JwtClaims jwtClaims = tokenConverter.convertToJwt(principal.getLoginToken().getOwnerDocument(),
+        IdToken jwtClaims = tokenConverter.convertToIdToken(principal.getLoginToken().getOwnerDocument(),
                                                           principal.getName(), 
                                                           clientId);
         JwsJwtCompactProducer p = new JwsJwtCompactProducer(jwtClaims);

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/9a67fbac/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/SamlTokenConverter.java
----------------------------------------------------------------------
diff --git a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/SamlTokenConverter.java
b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/SamlTokenConverter.java
index 24a5e2a..93cd672 100644
--- a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/SamlTokenConverter.java
+++ b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/SamlTokenConverter.java
@@ -19,10 +19,11 @@
 package org.apache.cxf.fediz.service.oidc;
 
 import org.w3c.dom.Document;
-import org.apache.cxf.rs.security.jose.jwt.JwtClaims;
+import org.apache.cxf.rs.security.oidc.common.IdToken;
+
  
 public interface SamlTokenConverter {
-    JwtClaims convertToJwt(Document samlDoc, 
-                           String subjectName,
-                           String audience);
+    IdToken convertToIdToken(Document samlDoc, 
+                             String subjectName,
+                             String audience);
 }


Mime
View raw message