Repository: cxf-fediz Updated Branches: refs/heads/master e353e52bc -> 1b28fbe14
Temp restoring an ehcache config resource to make it simpler to try an Ehcache provider quickly and renaming package 'account' to 'console' Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/1b28fbe1 Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/1b28fbe1 Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/1b28fbe1 Branch: refs/heads/master Commit: 1b28fbe1446c0490299a616b027d7ecae8bee041 Parents: e353e52 Author: Sergey Beryozkin <[email protected]> Authored: Thu May 5 11:23:44 2016 +0100 Committer: Sergey Beryozkin <[email protected]> Committed: Thu May 5 11:23:44 2016 +0100 ---------------------------------------------------------------------- .../fediz/service/oidc/account/UserConsole.java | 33 ----------- .../oidc/account/UserConsoleService.java | 61 -------------------- .../fediz/service/oidc/console/UserConsole.java | 33 +++++++++++ .../oidc/console/UserConsoleService.java | 61 ++++++++++++++++++++ .../src/main/resources/cxf-oauth2-ehcache.xml | 6 ++ .../main/webapp/WEB-INF/applicationContext.xml | 2 +- .../src/main/webapp/WEB-INF/data-manager.xml | 5 +- .../main/webapp/WEB-INF/views/userConsole.jsp | 2 +- 8 files changed, 104 insertions(+), 99 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/1b28fbe1/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/account/UserConsole.java ---------------------------------------------------------------------- diff --git a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/account/UserConsole.java b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/account/UserConsole.java deleted file mode 100644 index 1643ebf..0000000 --- a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/account/UserConsole.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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 UserConsole { - private String userName; - public UserConsole(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/1b28fbe1/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/account/UserConsoleService.java ---------------------------------------------------------------------- diff --git a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/account/UserConsoleService.java b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/account/UserConsoleService.java deleted file mode 100644 index c638ed2..0000000 --- a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/account/UserConsoleService.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * 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; - -import org.apache.cxf.fediz.service.oidc.clients.ClientRegistrationService; - -@Path("/") -public class UserConsoleService { - - private SecurityContext sc; - - private ClientRegistrationService clientRegService; - - @Context - public void setSecurityContext(SecurityContext securityContext) { - this.sc = securityContext; - clientRegService.setSecurityContext(securityContext); - } - - - @GET - @Produces(MediaType.TEXT_HTML) - public UserConsole getConsole() { - return new UserConsole(getUserName()); - } - private String getUserName() { - return sc.getUserPrincipal().getName(); - } - @Path("clients") - public ClientRegistrationService getClientRegService() { - return clientRegService; - } - public void setClientRegService(ClientRegistrationService clientRegService) { - this.clientRegService = clientRegService; - } - -} http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/1b28fbe1/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/console/UserConsole.java ---------------------------------------------------------------------- diff --git a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/console/UserConsole.java b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/console/UserConsole.java new file mode 100644 index 0000000..7eaa71e --- /dev/null +++ b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/console/UserConsole.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.console; + +public class UserConsole { + private String userName; + public UserConsole(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/1b28fbe1/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/console/UserConsoleService.java ---------------------------------------------------------------------- diff --git a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/console/UserConsoleService.java b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/console/UserConsoleService.java new file mode 100644 index 0000000..ef29295 --- /dev/null +++ b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/console/UserConsoleService.java @@ -0,0 +1,61 @@ +/** + * 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.console; + +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; + +import org.apache.cxf.fediz.service.oidc.clients.ClientRegistrationService; + +@Path("/") +public class UserConsoleService { + + private SecurityContext sc; + + private ClientRegistrationService clientRegService; + + @Context + public void setSecurityContext(SecurityContext securityContext) { + this.sc = securityContext; + clientRegService.setSecurityContext(securityContext); + } + + + @GET + @Produces(MediaType.TEXT_HTML) + public UserConsole getConsole() { + return new UserConsole(getUserName()); + } + private String getUserName() { + return sc.getUserPrincipal().getName(); + } + @Path("clients") + public ClientRegistrationService getClientRegService() { + return clientRegService; + } + public void setClientRegService(ClientRegistrationService clientRegService) { + this.clientRegService = clientRegService; + } + +} http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/1b28fbe1/services/oidc/src/main/resources/cxf-oauth2-ehcache.xml ---------------------------------------------------------------------- diff --git a/services/oidc/src/main/resources/cxf-oauth2-ehcache.xml b/services/oidc/src/main/resources/cxf-oauth2-ehcache.xml new file mode 100644 index 0000000..730b9bd --- /dev/null +++ b/services/oidc/src/main/resources/cxf-oauth2-ehcache.xml @@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<ehcache xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="false" monitoring="autodetect" dynamicConfig="true" name="fedizOidcSecurityCache"> + <diskStore path="java.io.tmpdir/oidc"/> + <defaultCache maxEntriesLocalHeap="5000" eternal="false" timeToIdleSeconds="3600" timeToLiveSeconds="3600" overflowToDisk="true" maxElementsOnDisk="10000000" diskPersistent="true" diskExpiryThreadIntervalSeconds="120" memoryStoreEvictionPolicy="LRU"/> + +</ehcache> http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/1b28fbe1/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 2704675..53dfdf8 100644 --- a/services/oidc/src/main/webapp/WEB-INF/applicationContext.xml +++ b/services/oidc/src/main/webapp/WEB-INF/applicationContext.xml @@ -135,7 +135,7 @@ </map> </property> </bean> - <bean id="consoleService" class="org.apache.cxf.fediz.service.oidc.account.UserConsoleService"> + <bean id="consoleService" class="org.apache.cxf.fediz.service.oidc.console.UserConsoleService"> <property name="clientRegService" ref="clientRegService"/> </bean> http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/1b28fbe1/services/oidc/src/main/webapp/WEB-INF/data-manager.xml ---------------------------------------------------------------------- diff --git a/services/oidc/src/main/webapp/WEB-INF/data-manager.xml b/services/oidc/src/main/webapp/WEB-INF/data-manager.xml index 622f3be..fa1d596 100644 --- a/services/oidc/src/main/webapp/WEB-INF/data-manager.xml +++ b/services/oidc/src/main/webapp/WEB-INF/data-manager.xml @@ -27,10 +27,9 @@ http://www.springframework.org/schema/util/spring-util.xsd "> - <!-- Remove this import if no JPA2 is used --> + <!-- Remove this import if no JPA2 is used --> <import resource="entity-manager.xml" /> - <bean id="applicationContextProvider" class="org.apache.cxf.fediz.service.oidc.handler.hrd.ApplicationContextProvider"/> <util:map id="supportedScopes"> @@ -46,7 +45,7 @@ <!-- If working with Ehcache: - - replace the class attribute with org.apache.cxf.rs.security.oauth2.grants.code.DefaultEhcacheCodeDataProvider + - replace the class attribute with org.apache.cxf.rs.security.oauth2.grants.code.DefaultEHCacheCodeDataProvider - remove 'entityManager' property To support the alternative data persistence strategies: either register a custom http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/1b28fbe1/services/oidc/src/main/webapp/WEB-INF/views/userConsole.jsp ---------------------------------------------------------------------- diff --git a/services/oidc/src/main/webapp/WEB-INF/views/userConsole.jsp b/services/oidc/src/main/webapp/WEB-INF/views/userConsole.jsp index 5e4da0d..063fe9e 100644 --- a/services/oidc/src/main/webapp/WEB-INF/views/userConsole.jsp +++ b/services/oidc/src/main/webapp/WEB-INF/views/userConsole.jsp @@ -1,5 +1,5 @@ <%@ page - import="javax.servlet.http.HttpServletRequest,java.util.Map,java.util.Iterator,org.apache.cxf.fediz.service.oidc.account.UserConsole"%> + import="javax.servlet.http.HttpServletRequest,java.util.Map,java.util.Iterator,org.apache.cxf.fediz.service.oidc.console.UserConsole"%> <% UserConsole account = (UserConsole)request.getAttribute("data"); String basePath = request.getContextPath() + request.getServletPath();
