Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1D5F418091 for ; Fri, 18 Mar 2016 17:39:33 +0000 (UTC) Received: (qmail 75105 invoked by uid 500); 18 Mar 2016 17:39:33 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 75052 invoked by uid 500); 18 Mar 2016 17:39:33 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 75042 invoked by uid 99); 18 Mar 2016 17:39:33 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Mar 2016 17:39:33 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DAD78DFB7B; Fri, 18 Mar 2016 17:39:32 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sergeyb@apache.org To: commits@cxf.apache.org Message-Id: <8cf03be838514b249d1921c0833922fc@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cxf-fediz git commit: Initial prototyping a home/account service Date: Fri, 18 Mar 2016 17:39:32 +0000 (UTC) Repository: cxf-fediz Updated Branches: refs/heads/master cb89526b5 -> 44b61cfae Initial prototyping a home/account service Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/44b61cfa Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/44b61cfa Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/44b61cfa Branch: refs/heads/master Commit: 44b61cfaedbc3e6829d7b3d7aaa586b60b28f2f5 Parents: cb89526 Author: Sergey Beryozkin Authored: Fri Mar 18 17:39:16 2016 +0000 Committer: Sergey Beryozkin Committed: Fri Mar 18 17:39:16 2016 +0000 ---------------------------------------------------------------------- .../fediz/service/oidc/account/UserAccount.java | 33 ++++++++++ .../oidc/account/UserAccountService.java | 44 +++++++++++++ .../main/webapp/WEB-INF/applicationContext.xml | 10 +++ .../main/webapp/WEB-INF/views/userAccount.jsp | 67 ++++++++++++++++++++ services/oidc/src/main/webapp/WEB-INF/web.xml | 13 ++++ 5 files changed, 167 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/44b61cfa/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/account/UserAccount.java ---------------------------------------------------------------------- diff --git a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/account/UserAccount.java b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/account/UserAccount.java new file mode 100644 index 0000000..e5a9ee6 --- /dev/null +++ b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/account/UserAccount.java @@ -0,0 +1,33 @@ +/** + * 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.fediz.service.oidc.account; + +public class UserAccount { + private String userName; + public UserAccount(String userName) { + this.userName = userName; + } + public String getUserName() { + return userName; + } + public void setUserName(String userName) { + this.userName = userName; + } + +} http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/44b61cfa/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/account/UserAccountService.java ---------------------------------------------------------------------- diff --git a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/account/UserAccountService.java b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/account/UserAccountService.java new file mode 100644 index 0000000..d56c2d8 --- /dev/null +++ b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/account/UserAccountService.java @@ -0,0 +1,44 @@ +/** + * 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.fediz.service.oidc.account; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.SecurityContext; + +@Path("/") +public class UserAccountService { + + @Context + private SecurityContext sc; + + @GET + @Produces(MediaType.TEXT_HTML) + public UserAccount getAccount() { + return new UserAccount(getUserName()); + } + private String getUserName() { + return sc.getUserPrincipal().getName(); + } + +} http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/44b61cfa/services/oidc/src/main/webapp/WEB-INF/applicationContext.xml ---------------------------------------------------------------------- diff --git a/services/oidc/src/main/webapp/WEB-INF/applicationContext.xml b/services/oidc/src/main/webapp/WEB-INF/applicationContext.xml index 8a51037..8f774cf 100644 --- a/services/oidc/src/main/webapp/WEB-INF/applicationContext.xml +++ b/services/oidc/src/main/webapp/WEB-INF/applicationContext.xml @@ -143,6 +143,16 @@ + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/44b61cfa/services/oidc/src/main/webapp/WEB-INF/views/userAccount.jsp ---------------------------------------------------------------------- diff --git a/services/oidc/src/main/webapp/WEB-INF/views/userAccount.jsp b/services/oidc/src/main/webapp/WEB-INF/views/userAccount.jsp new file mode 100644 index 0000000..e48f517 --- /dev/null +++ b/services/oidc/src/main/webapp/WEB-INF/views/userAccount.jsp @@ -0,0 +1,67 @@ +<%@ page + import="javax.servlet.http.HttpServletRequest,java.util.Map,java.util.Iterator,org.apache.cxf.fediz.service.oidc.account.UserAccount"%> +<% + UserAccount account = (UserAccount)request.getAttribute("data"); + String basePath = request.getContextPath() + request.getServletPath(); + if (!basePath.endsWith("/")) { + basePath += "/"; + } +%> + + +User Account + + + +

Welcome to Fediz OpenId Connect Console

+

Client Registrations

+ + http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/44b61cfa/services/oidc/src/main/webapp/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/services/oidc/src/main/webapp/WEB-INF/web.xml b/services/oidc/src/main/webapp/WEB-INF/web.xml index e76a95d..738c8bb 100644 --- a/services/oidc/src/main/webapp/WEB-INF/web.xml +++ b/services/oidc/src/main/webapp/WEB-INF/web.xml @@ -42,6 +42,10 @@ FederationFilter /clients/* + + FederationFilter + /home/* + contextConfigLocation @@ -91,6 +95,15 @@ * + + + OIDC Account Protected Area + /home/* + + + * + + WSFED WSFED