cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject [3/3] cxf git commit: Setting kid too
Date Wed, 25 Nov 2015 13:18:53 GMT
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/a837a8fa
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a837a8fa
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a837a8fa

Branch: refs/heads/3.1.x-fixes
Commit: a837a8fa567526c3c674d6b6b9a53fd01d4eef95
Parents: 628e041
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:18:27 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/a837a8fa/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 94e7884..eca04a5 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
@@ -373,12 +373,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