Repository: cxf Updated Branches: refs/heads/master 9511cd40a -> 286023087
Adding missing OIDC filter classes Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/28602308 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/28602308 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/28602308 Branch: refs/heads/master Commit: 2860230873508b27790590e3d07c045a6ad53b75 Parents: 9511cd4 Author: Sergey Beryozkin <[email protected]> Authored: Wed Dec 24 17:09:44 2014 +0000 Committer: Sergey Beryozkin <[email protected]> Committed: Wed Dec 24 17:09:44 2014 +0000 ---------------------------------------------------------------------- .../oidc/rp/OidcClientCodeRequestFilter.java | 38 +++++++++++++++++ .../oidc/rp/OidcClientTokenContext.java | 43 ++++++++++++++++++++ 2 files changed, 81 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/28602308/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientCodeRequestFilter.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientCodeRequestFilter.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientCodeRequestFilter.java new file mode 100644 index 0000000..f5f9cc5 --- /dev/null +++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientCodeRequestFilter.java @@ -0,0 +1,38 @@ +/** + * 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.rp; + +import org.apache.cxf.rs.security.oauth2.client.ClientCodeRequestFilter; +import org.apache.cxf.rs.security.oauth2.client.ClientTokenContext; +import org.apache.cxf.rs.security.oauth2.common.ClientAccessToken; + +public class OidcClientCodeRequestFilter extends ClientCodeRequestFilter { + + private UserInfoClient userInfoClient; + @Override + protected ClientTokenContext createTokenContext(ClientAccessToken at) { + OidcClientTokenContext ctx = new OidcClientTokenContext(); + ctx.setIdToken(userInfoClient.getIdToken(at, getConsumer().getKey())); + ctx.setUserInfo(userInfoClient.getUserInfo(at, ctx.getIdToken())); + return ctx; + } + public void setUserInfoClient(UserInfoClient userInfoClient) { + this.userInfoClient = userInfoClient; + } +} http://git-wip-us.apache.org/repos/asf/cxf/blob/28602308/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientTokenContext.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientTokenContext.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientTokenContext.java new file mode 100644 index 0000000..696879c --- /dev/null +++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientTokenContext.java @@ -0,0 +1,43 @@ +/** + * 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.rp; + +import java.io.Serializable; + +import org.apache.cxf.rs.security.oauth2.client.ClientTokenContext; +import org.apache.cxf.rs.security.oidc.common.IdToken; +import org.apache.cxf.rs.security.oidc.common.UserInfo; + +public class OidcClientTokenContext extends ClientTokenContext implements Serializable { + private static final long serialVersionUID = 117239739331303618L; + private IdToken idToken; + private UserInfo userInfo; + public IdToken getIdToken() { + return idToken; + } + public void setIdToken(IdToken idToken) { + this.idToken = idToken; + } + public UserInfo getUserInfo() { + return userInfo; + } + public void setUserInfo(UserInfo userInfo) { + this.userInfo = userInfo; + } +}
