Repository: cxf Updated Branches: refs/heads/master e4361623a -> 06190315f
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/06190315 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/06190315 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/06190315 Branch: refs/heads/master Commit: 06190315fc2a0e309067d8c69f924f7788c4d919 Parents: e436162 Author: Sergey Beryozkin <sberyoz...@gmail.com> Authored: Wed Nov 25 13:16:17 2015 +0000 Committer: Sergey Beryozkin <sberyoz...@gmail.com> Committed: Wed Nov 25 13:16:17 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/06190315/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();