DELTASPIKE-1201 add logout link to secured/home.xhtml
Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/80c9ae77 Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/80c9ae77 Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/80c9ae77 Branch: refs/heads/master Commit: 80c9ae77da24932e967c10dfc6ca38bb7e5a5f18 Parents: a876251 Author: subaochen <subaoc...@126.com> Authored: Wed Sep 7 14:58:47 2016 +0800 Committer: John D. Ament <johndam...@apache.org> Committed: Sat Oct 15 09:22:45 2016 -0400 ---------------------------------------------------------------------- deltaspike/examples/pom.xml | 2 +- .../picketlink/AuthenticationListener.java | 7 ++++- .../requestedpage/picketlink/Pages.java | 10 +++--- .../src/main/webapp/index.html | 5 +-- .../src/main/webapp/secured/home.xhtml | 6 +++- .../src/main/webapp/secured/test.xhtml | 33 ++++++++++++++++++++ 6 files changed, 54 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltaspike/blob/80c9ae77/deltaspike/examples/pom.xml ---------------------------------------------------------------------- diff --git a/deltaspike/examples/pom.xml b/deltaspike/examples/pom.xml index 677963c..52238b7 100644 --- a/deltaspike/examples/pom.xml +++ b/deltaspike/examples/pom.xml @@ -99,7 +99,7 @@ <plugin> <groupId>org.wildfly.plugins</groupId> <artifactId>wildfly-maven-plugin</artifactId> - <version>1.0.1.Final</version> + <version>1.1.0.Alpha8</version> </plugin> </plugins> </build> http://git-wip-us.apache.org/repos/asf/deltaspike/blob/80c9ae77/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/AuthenticationListener.java ---------------------------------------------------------------------- diff --git a/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/AuthenticationListener.java b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/AuthenticationListener.java index 5a048df..2d2d53b 100644 --- a/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/AuthenticationListener.java +++ b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/AuthenticationListener.java @@ -21,6 +21,7 @@ package org.apache.deltaspike.example.security.requestedpage.picketlink; import org.apache.deltaspike.core.api.config.view.navigation.ViewNavigationHandler; import org.picketlink.authentication.event.LoggedInEvent; import org.picketlink.authentication.event.LoginFailedEvent; +import org.picketlink.authentication.event.PostLoggedOutEvent; import javax.enterprise.event.Observes; import javax.inject.Inject; @@ -44,4 +45,8 @@ public class AuthenticationListener this.viewNavigationHandler.navigateTo(Pages.Login.class); } -} \ No newline at end of file + public void handleLogout(@Observes PostLoggedOutEvent event) + { + this.viewNavigationHandler.navigateTo(Pages.Login.class); + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/80c9ae77/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/Pages.java ---------------------------------------------------------------------- diff --git a/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/Pages.java b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/Pages.java index 973968f..53db50d 100644 --- a/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/Pages.java +++ b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/Pages.java @@ -31,14 +31,16 @@ public interface Pages } @Folder(name = "/secured") + @Secured(LoggedInAccessDecisionVoter.class) interface Secure - { - - @Secured(LoggedInAccessDecisionVoter.class) + { class Home implements ViewConfig { } - + + class Test implements ViewConfig + { + } } } http://git-wip-us.apache.org/repos/asf/deltaspike/blob/80c9ae77/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/index.html ---------------------------------------------------------------------- diff --git a/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/index.html b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/index.html index d6ecf0b..99c5c01 100644 --- a/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/index.html +++ b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/index.html @@ -25,9 +25,10 @@ <h1>Index</h1> <p> - This link points to a secured page and should redirect to login page: + These link points to secured pages and should redirect to login page: <br> - <a href="secured/home.xhtml">Go Home</a> + <a href="secured/home.xhtml">Go Home</a></br> + <a href="secured/test.xhtml">Go Test Page</a> </p> </body> </html> http://git-wip-us.apache.org/repos/asf/deltaspike/blob/80c9ae77/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/secured/home.xhtml ---------------------------------------------------------------------- diff --git a/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/secured/home.xhtml b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/secured/home.xhtml index 55a6120..38929da 100644 --- a/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/secured/home.xhtml +++ b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/secured/home.xhtml @@ -17,7 +17,8 @@ ~ specific language governing permissions and limitations ~ under the License. --> -<html xmlns="http://www.w3.org/1999/xhtml"> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html"> <head> <title>Home Page</title> </head> @@ -26,6 +27,9 @@ <h1>Hello!</h1> <p>Welcome Home</p> +<h:form> + <h:commandButton value="logout" action="#{identity.logout}"/> +</h:form> </body> http://git-wip-us.apache.org/repos/asf/deltaspike/blob/80c9ae77/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/secured/test.xhtml ---------------------------------------------------------------------- diff --git a/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/secured/test.xhtml b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/secured/test.xhtml new file mode 100644 index 0000000..6ec9de9 --- /dev/null +++ b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/secured/test.xhtml @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- + ~ 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. + --> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html"> +<head> + <title>Test Page</title> +</head> + +<body> +<h1>Hello!</h1> + +<p>Welcome to Secured Test Page</p> + +</body> + +</html>