cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Updating Oidc key service to get the keys from the external web service if required
Date Mon, 14 Mar 2016 10:09:06 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 4b37844e9 -> a44eb903a


Updating Oidc key service to get the keys from the external web service if required


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

Branch: refs/heads/master
Commit: a44eb903afab8df212b48cb543c9c363c24ebd35
Parents: 4b37844
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Mon Mar 14 10:08:48 2016 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Mon Mar 14 10:08:48 2016 +0000

----------------------------------------------------------------------
 .../rs/security/oidc/idp/OidcKeysService.java    | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/a44eb903/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcKeysService.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcKeysService.java
b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcKeysService.java
index e2c140d..d312f9d 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcKeysService.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcKeysService.java
@@ -24,6 +24,7 @@ import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
 
+import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.rs.security.jose.jwk.JsonWebKeys;
 import org.apache.cxf.rs.security.jose.jws.JwsUtils;
@@ -32,15 +33,29 @@ import org.apache.cxf.rs.security.jose.jws.JwsUtils;
 public class OidcKeysService {
 
     private volatile JsonWebKeys keySet;
+    private WebClient keySetClient;
     
     @GET
     @Produces("application/json")
     public JsonWebKeys getPublicVerificationKeys() {
         if (keySet == null) {
-            Properties props = JwsUtils.loadSignatureInProperties(true);
-            keySet = JwsUtils.loadPublicVerificationKeys(JAXRSUtils.getCurrentMessage(),
props);
+            if (keySetClient == null) {
+                keySet = getFromLocalStore();
+            } else {
+                keySet = keySetClient.get(JsonWebKeys.class);
+            }
+            
         }
         return keySet;
     }
+
+    private static JsonWebKeys getFromLocalStore() {
+        Properties props = JwsUtils.loadSignatureInProperties(true);
+        return JwsUtils.loadPublicVerificationKeys(JAXRSUtils.getCurrentMessage(), props);
+    }
+
+    public void setKeySetClient(WebClient keySetClient) {
+        this.keySetClient = keySetClient;
+    }
     
 }


Mime
View raw message