cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject [1/3] cxf git commit: Setting kid too
Date Wed, 25 Nov 2015 13:20:44 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes c2d9dca13 -> 23d9ae6ce


Setting kid too


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

Branch: refs/heads/3.0.x-fixes
Commit: 23d9ae6ce4632e78856fc1fdcf23ee101d4c444d
Parents: baa0417
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Wed Nov 25 13:16:17 2015 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Wed Nov 25 13:20:26 2015 +0000

----------------------------------------------------------------------
 .../org/apache/cxf/rs/security/jose/jwk/JwkUtils.java     | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/23d9ae6c/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JwkUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JwkUtils.java
b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JwkUtils.java
index 2dec8d3..c8fddf4 100644
--- a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JwkUtils.java
+++ b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JwkUtils.java
@@ -372,12 +372,18 @@ public final class JwkUtils {
         return jwk;
     }
     public static JsonWebKey fromPublicKey(PublicKey key, Properties props, String algoProp)
{
+        JsonWebKey jwk = null;
         if (key instanceof RSAPublicKey) {
-            return JwkUtils.fromRSAPublicKey((RSAPublicKey)key, algoProp);
+            jwk = JwkUtils.fromRSAPublicKey((RSAPublicKey)key, props.getProperty(algoProp));
         } else {
-            return JwkUtils.fromECPublicKey((ECPublicKey)key, 
+            jwk = JwkUtils.fromECPublicKey((ECPublicKey)key, 
                                          props.getProperty(JoseConstants.RSSEC_EC_CURVE));
         }
+        String kid = props.getProperty(JoseConstants.RSSEC_KEY_STORE_ALIAS);
+        if (kid != null) {
+            jwk.setKeyId(kid);
+        }
+        return jwk;
     }
     public static JsonWebKey fromX509CertificateChain(List<X509Certificate> chain,
String algo) {
         JsonWebKey jwk = new JsonWebKey();


Mime
View raw message