Repository: cxf Updated Branches: refs/heads/3.1.x-fixes a837a8fa5 -> deea74014
Prototyping OIDC Keys service Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/deea7401 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/deea7401 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/deea7401 Branch: refs/heads/3.1.x-fixes Commit: deea740143ef9b2d85c5dc2139f6918ae10ca548 Parents: a837a8f Author: Sergey Beryozkin <sberyoz...@gmail.com> Authored: Wed Nov 25 14:01:51 2015 +0000 Committer: Sergey Beryozkin <sberyoz...@gmail.com> Committed: Wed Nov 25 14:03:17 2015 +0000 ---------------------------------------------------------------------- .../rs/security/oidc/idp/OidcKeysService.java | 46 ++++++++++++++++++++ 1 file changed, 46 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/deea7401/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 new file mode 100644 index 0000000..f6c214f --- /dev/null +++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcKeysService.java @@ -0,0 +1,46 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.rs.security.oidc.idp; + +import java.util.Properties; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +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; + +@Path("keys") +public class OidcKeysService { + + private volatile JsonWebKeys keySet; + + @GET + @Produces("application/json") + public JsonWebKeys getPublicVerificationKeys() { + Properties props = JwsUtils.loadSignatureInProperties(true); + if (keySet == null) { + keySet = JwsUtils.loadPublicVerificationKeys(JAXRSUtils.getCurrentMessage(), props); + } + return keySet; + } + +}