You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by rs...@apache.org on 2015/05/12 20:42:25 UTC

[2/2] deltaspike git commit: DELTASPIKE-898 Make documentation structure more comprehensible

DELTASPIKE-898 Make documentation structure more comprehensible

* restructured security doc page
* also moved long code examples from security doc to actual examples projects


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/e67d64a2
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/e67d64a2
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/e67d64a2

Branch: refs/heads/master
Commit: e67d64a247d110db8e4f51ba8eb403e28c05710f
Parents: 1c828f3
Author: Ron Smeral <rs...@apache.org>
Authored: Tue May 12 20:38:53 2015 +0200
Committer: Ron Smeral <rs...@apache.org>
Committed: Tue May 12 20:41:18 2015 +0200

----------------------------------------------------------------------
 deltaspike/examples/pom.xml                     |   2 +
 .../README.md                                   |  10 +
 .../pom.xml                                     |  73 +++++
 .../cdi/AuthenticationListener.java             |  45 +++
 .../cdi/LoggedInAccessDecisionVoter.java        |  73 +++++
 .../requestedpage/cdi/LoginController.java      |  97 +++++++
 .../security/requestedpage/cdi/Pages.java       |  43 +++
 .../security/requestedpage/cdi/UserEvent.java   |  30 ++
 .../src/main/webapp/WEB-INF/beans.xml           |  26 ++
 .../src/main/webapp/WEB-INF/faces-config.xml    |   8 +
 .../src/main/webapp/WEB-INF/web.xml             |  41 +++
 .../src/main/webapp/index.html                  |  15 +
 .../src/main/webapp/login.xhtml                 |  26 ++
 .../src/main/webapp/secured/home.xhtml          |  14 +
 .../README.md                                   |  10 +
 .../pom.xml                                     |  93 +++++++
 .../picketlink/AuthenticationListener.java      |  47 ++++
 .../requestedpage/picketlink/Initializer.java   |  57 ++++
 .../picketlink/LoggedInAccessDecisionVoter.java |  76 +++++
 .../requestedpage/picketlink/Pages.java         |  44 +++
 .../src/main/webapp/WEB-INF/beans.xml           |  26 ++
 .../src/main/webapp/WEB-INF/faces-config.xml    |   8 +
 .../src/main/webapp/WEB-INF/web.xml             |  41 +++
 .../src/main/webapp/index.html                  |  15 +
 .../src/main/webapp/login.xhtml                 |  26 ++
 .../src/main/webapp/secured/home.xhtml          |  14 +
 .../src/main/asciidoc/bean-validation.adoc      |   8 +-
 .../src/main/asciidoc/container-control.adoc    |  24 +-
 documentation/src/main/asciidoc/data.adoc       |  78 +++---
 documentation/src/main/asciidoc/jpa.adoc        |  12 +-
 documentation/src/main/asciidoc/jsf.adoc        | 170 ++++++------
 .../src/main/asciidoc/partial-bean.adoc         |   6 +-
 documentation/src/main/asciidoc/scheduler.adoc  |  10 +-
 documentation/src/main/asciidoc/security.adoc   | 278 +++++--------------
 documentation/src/main/asciidoc/servlet.adoc    |  26 +-
 .../src/main/asciidoc/test-control.adoc         |  42 ++-
 36 files changed, 1205 insertions(+), 409 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/examples/pom.xml b/deltaspike/examples/pom.xml
index f8dbfc3..3f61532 100644
--- a/deltaspike/examples/pom.xml
+++ b/deltaspike/examples/pom.xml
@@ -37,6 +37,8 @@
         <module>jse-examples</module>
         <module>jsf-examples</module>
         <module>jsf-playground</module>
+        <module>security-requested-page-after-login-cdi</module>
+        <module>security-requested-page-after-login-picketlink</module>
         <module>scheduler-playground</module>
     </modules>
 

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/security-requested-page-after-login-cdi/README.md
----------------------------------------------------------------------
diff --git a/deltaspike/examples/security-requested-page-after-login-cdi/README.md b/deltaspike/examples/security-requested-page-after-login-cdi/README.md
new file mode 100644
index 0000000..eced607
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-cdi/README.md
@@ -0,0 +1,10 @@
+Making initially requested secured page available for redirect after login with CDI
+===================================================================================
+
+The following scenario is commonly seen in web applications:
+
+1. User requests a web page
+2. The web page is restricted to logged in users so the browser is redirected to login page
+3. After successful login, the user is redirected back to the originally requested page
+
+This example shows pure CDI implementation of this technique.

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/security-requested-page-after-login-cdi/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/examples/security-requested-page-after-login-cdi/pom.xml b/deltaspike/examples/security-requested-page-after-login-cdi/pom.xml
new file mode 100644
index 0000000..2bf42e8
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-cdi/pom.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    
+    <parent>
+        <groupId>org.apache.deltaspike.examples</groupId>
+        <artifactId>examples-project</artifactId>
+        <version>1.3.1-SNAPSHOT</version>
+    </parent>
+    
+    <artifactId>deltaspike-security-requested-page-after-login-cdi</artifactId>
+    <packaging>war</packaging>
+    <name>DeltaSpike Example: Show requested page after login with CDI</name>
+
+    <properties>
+        <deploy.skip>true</deploy.skip>
+        <picketlink.version>2.7.0.Final</picketlink.version>
+    </properties>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.myfaces.core</groupId>
+            <artifactId>myfaces-api</artifactId>
+            <version>${myfaces2.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <!-- DeltaSpike modules -->
+        <dependency>
+            <groupId>org.apache.deltaspike.core</groupId>
+            <artifactId>deltaspike-core-api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.deltaspike.core</groupId>
+            <artifactId>deltaspike-core-impl</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.deltaspike.modules</groupId>
+            <artifactId>deltaspike-jsf-module-api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.deltaspike.modules</groupId>
+            <artifactId>deltaspike-jsf-module-impl</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.deltaspike.modules</groupId>
+            <artifactId>deltaspike-security-module-api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.deltaspike.modules</groupId>
+            <artifactId>deltaspike-security-module-impl</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <finalName>${project.artifactId}</finalName>
+    </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/AuthenticationListener.java
----------------------------------------------------------------------
diff --git a/deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/AuthenticationListener.java b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/AuthenticationListener.java
new file mode 100644
index 0000000..77df254
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/AuthenticationListener.java
@@ -0,0 +1,45 @@
+/*
+ * 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.deltaspike.example.security.requestedpage.cdi;
+
+import org.apache.deltaspike.core.api.config.view.navigation.ViewNavigationHandler;
+
+import javax.enterprise.event.Observes;
+import javax.inject.Inject;
+
+public class AuthenticationListener {
+
+    @Inject
+    private ViewNavigationHandler viewNavigationHandler;
+
+    @Inject
+    private LoggedInAccessDecisionVoter loggedInAccessDecisionVoter;
+
+    public void handleLoggedIn(@Observes UserEvent.LoggedIn event) {
+        this.viewNavigationHandler.navigateTo(loggedInAccessDecisionVoter.getDeniedPage());
+        System.err.println("handling loggedin");
+    }
+
+    public void handleFailed(@Observes UserEvent.LoginFailed event)
+    {
+        this.viewNavigationHandler.navigateTo(Pages.Login.class);
+        System.err.println("handling failed");
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/LoggedInAccessDecisionVoter.java
----------------------------------------------------------------------
diff --git a/deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/LoggedInAccessDecisionVoter.java b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/LoggedInAccessDecisionVoter.java
new file mode 100644
index 0000000..c613af9
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/LoggedInAccessDecisionVoter.java
@@ -0,0 +1,73 @@
+/*
+ * 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.deltaspike.example.security.requestedpage.cdi;
+
+import org.apache.deltaspike.core.api.config.view.ViewConfig;
+import org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;
+import org.apache.deltaspike.security.api.authorization.AbstractAccessDecisionVoter;
+import org.apache.deltaspike.security.api.authorization.AccessDecisionVoterContext;
+import org.apache.deltaspike.security.api.authorization.SecurityViolation;
+
+import javax.enterprise.context.SessionScoped;
+import javax.faces.context.FacesContext;
+import javax.inject.Inject;
+import java.util.Set;
+
+@SessionScoped //or @WindowScoped
+public class LoggedInAccessDecisionVoter extends AbstractAccessDecisionVoter
+{
+
+    @Inject
+    private ViewConfigResolver viewConfigResolver;
+
+    @Inject
+    LoginController loginController;
+
+    private Class<? extends ViewConfig> deniedPage = Pages.Secure.Home.class;
+
+    @Override
+    protected void checkPermission(AccessDecisionVoterContext context, Set<SecurityViolation> violations)
+    {
+        if (loginController.isLoggedIn())
+        {
+            // no violations, pass
+        }
+        else
+        {
+            violations.add(new SecurityViolation()
+            {
+                @Override
+                public String getReason()
+                {
+                    return "User must be logged in to access this resource";
+                }
+            });
+
+            // remember the requested page
+            deniedPage = viewConfigResolver
+                    .getViewConfigDescriptor(FacesContext.getCurrentInstance().getViewRoot().getViewId())
+                    .getConfigClass();
+        }
+    }
+
+    public Class<? extends ViewConfig> getDeniedPage()
+    {
+        return deniedPage;
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/LoginController.java
----------------------------------------------------------------------
diff --git a/deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/LoginController.java b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/LoginController.java
new file mode 100644
index 0000000..7b6c5f9
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/LoginController.java
@@ -0,0 +1,97 @@
+/*
+ * 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.deltaspike.example.security.requestedpage.cdi;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Event;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named
+@RequestScoped
+public class LoginController
+{
+    public static final String DEFAULT_USER = "john";
+
+    public static final String DEFAULT_PASSWORD = "123456";
+
+    public static final String DEFAULT_NAME = "John User";
+
+    private String username;
+
+    private String password;
+
+    private boolean loggedIn = false;
+
+    @Inject
+    private Event<UserEvent.LoggedIn> evtLoggedIn;
+
+    @Inject
+    private Event<UserEvent.LoginFailed> evtLoginFailed;
+
+    public void login()
+    {
+        if (DEFAULT_USER.equals(username) && DEFAULT_PASSWORD.equals(password))
+        {
+            loggedIn = true;
+            evtLoggedIn.fire(new UserEvent.LoggedIn());
+            System.err.println("logged in");
+        }
+        else
+        {
+            evtLoginFailed.fire(new UserEvent.LoginFailed());
+            System.err.println("failed");
+        }
+    }
+
+    public void logout()
+    {
+        loggedIn = false;
+    }
+
+    public String getPassword()
+    {
+        return password;
+    }
+
+    public void setPassword(String password)
+    {
+        this.password = password;
+    }
+
+    public String getUsername()
+    {
+        return username;
+    }
+
+    public void setUsername(String username)
+    {
+        this.username = username;
+    }
+
+    public String getName()
+    {
+        return DEFAULT_NAME;
+    }
+
+    public boolean isLoggedIn()
+    {
+        return loggedIn;
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/Pages.java
----------------------------------------------------------------------
diff --git a/deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/Pages.java b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/Pages.java
new file mode 100644
index 0000000..ce46fc0
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/Pages.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.deltaspike.example.security.requestedpage.cdi;
+
+import org.apache.deltaspike.core.api.config.view.DefaultErrorView;
+import org.apache.deltaspike.core.api.config.view.ViewConfig;
+import org.apache.deltaspike.jsf.api.config.view.Folder;
+import org.apache.deltaspike.security.api.authorization.Secured;
+
+@Folder(name = "/")
+public interface Pages
+{
+    class Login extends DefaultErrorView
+    {
+    }
+
+    @Folder(name = "/secured")
+    interface Secure extends ViewConfig
+    {
+
+        @Secured(LoggedInAccessDecisionVoter.class)
+        class Home implements Secure
+        {
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/UserEvent.java
----------------------------------------------------------------------
diff --git a/deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/UserEvent.java b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/UserEvent.java
new file mode 100644
index 0000000..fb035b8
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/java/org/apache/deltaspike/example/security/requestedpage/cdi/UserEvent.java
@@ -0,0 +1,30 @@
+/*
+ * 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.deltaspike.example.security.requestedpage.cdi;
+
+public class UserEvent
+{
+    public static class LoggedIn
+    {
+    }
+
+    public static class LoginFailed
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/WEB-INF/beans.xml
----------------------------------------------------------------------
diff --git a/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/WEB-INF/beans.xml b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..d2acfab
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,26 @@
+<!--
+    JBoss, Home of Professional Open Source
+    Copyright 2014, Red Hat, Inc. and/or its affiliates, and individual
+    contributors by the @authors tag. See the copyright.txt in the
+    distribution for a full listing of individual contributors.
+
+    Licensed 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.
+-->
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="
+      http://java.sun.com/xml/ns/javaee
+      http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+
+    <interceptors>
+        <class>org.apache.deltaspike.security.impl.extension.SecurityInterceptor</class>
+    </interceptors>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/WEB-INF/faces-config.xml
----------------------------------------------------------------------
diff --git a/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/WEB-INF/faces-config.xml b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..cce0e2f
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config
+    xmlns="http://java.sun.com/xml/ns/javaee"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd"
+    version="2.1">
+
+</faces-config>

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/WEB-INF/web.xml b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..23eddbc
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+	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.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+         version="3.0">
+
+    <context-param>
+        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+        <param-value>.xhtml</param-value>
+    </context-param>
+
+    <servlet>
+        <servlet-name>Faces Servlet</servlet-name>
+        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>Faces Servlet</servlet-name>
+        <url-pattern>*.xhtml</url-pattern>
+    </servlet-mapping>
+
+    <welcome-file-list>
+        <welcome-file>index.html</welcome-file>
+    </welcome-file-list>
+</web-app>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/index.html
----------------------------------------------------------------------
diff --git a/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/index.html b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/index.html
new file mode 100644
index 0000000..d252a75
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/index.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>Index</title>
+</head>
+<body>
+<h1>Index</h1>
+
+<p>
+    This link points to a secured page and should redirect to login page:
+    <br>
+    <a href="secured/home.xhtml">Go Home</a>
+</p>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/login.xhtml
----------------------------------------------------------------------
diff --git a/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/login.xhtml b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/login.xhtml
new file mode 100644
index 0000000..5874598
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/login.xhtml
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:h="http://java.sun.com/jsf/html">
+<head>
+    <title>Login</title>
+</head>
+
+<body>
+<h1>Log in</h1>
+<h:messages globalOnly="true"></h:messages>
+<h:form id="loginForm">
+    <h:outputLabel value="Username:" for="username"/><br/>
+    <h:inputText value="#{loginController.username}" id="username"/><br/><br/>
+    <h:outputLabel value="Password:" for="password"/><br/>
+    <h:inputSecret value="#{loginController.password}" id="password"/><br/>
+    <h:commandButton value="Log in" action="#{loginController.login()}" id="loginBtn"/>
+</h:form>
+
+<p>
+    <b>Hint:</b> log in as john / 123456
+</p>
+<br/>
+
+</body>
+
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/secured/home.xhtml
----------------------------------------------------------------------
diff --git a/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/secured/home.xhtml b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/secured/home.xhtml
new file mode 100644
index 0000000..f2fe303
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-cdi/src/main/webapp/secured/home.xhtml
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <title>Home Page</title>
+</head>
+
+<body>
+<h1>Hello, #{loginController.name}!</h1>
+
+<p>Welcome Home</p>
+
+</body>
+
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/security-requested-page-after-login-picketlink/README.md
----------------------------------------------------------------------
diff --git a/deltaspike/examples/security-requested-page-after-login-picketlink/README.md b/deltaspike/examples/security-requested-page-after-login-picketlink/README.md
new file mode 100644
index 0000000..ff6cff9
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-picketlink/README.md
@@ -0,0 +1,10 @@
+Making initially requested secured page available for redirect after login with PicketLink
+==========================================================================================
+
+The following scenario is commonly seen in web applications:
+
+1. User requests a web page
+2. The web page is restricted to logged in users so the browser is redirected to login page
+3. After successful login, the user is redirected back to the originally requested page
+
+This example shows an implementation of this technique using PicketLink.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/security-requested-page-after-login-picketlink/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/examples/security-requested-page-after-login-picketlink/pom.xml b/deltaspike/examples/security-requested-page-after-login-picketlink/pom.xml
new file mode 100644
index 0000000..9b15373
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-picketlink/pom.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.deltaspike.examples</groupId>
+        <artifactId>examples-project</artifactId>
+        <version>1.3.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>deltaspike-security-requested-page-after-login-picketlink</artifactId>
+    <packaging>war</packaging>
+    <name>DeltaSpike Example: Show requested page after login with PicketLink</name>
+
+    <properties>
+        <deploy.skip>true</deploy.skip>
+        <picketlink.version>2.7.0.Final</picketlink.version>
+    </properties>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.myfaces.core</groupId>
+            <artifactId>myfaces-api</artifactId>
+            <version>${myfaces2.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <!-- DeltaSpike modules -->
+        <dependency>
+            <groupId>org.apache.deltaspike.core</groupId>
+            <artifactId>deltaspike-core-api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.deltaspike.core</groupId>
+            <artifactId>deltaspike-core-impl</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.deltaspike.modules</groupId>
+            <artifactId>deltaspike-jsf-module-api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.deltaspike.modules</groupId>
+            <artifactId>deltaspike-jsf-module-impl</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.deltaspike.modules</groupId>
+            <artifactId>deltaspike-security-module-api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.deltaspike.modules</groupId>
+            <artifactId>deltaspike-security-module-impl</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.picketlink</groupId>
+            <artifactId>picketlink-api</artifactId>
+            <scope>compile</scope>
+            <version>${picketlink.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.picketlink</groupId>
+            <artifactId>picketlink-impl</artifactId>
+            <scope>compile</scope>
+            <version>${picketlink.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.openejb</groupId>
+            <artifactId>javaee-api</artifactId>
+            <version>6.0-6</version>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <finalName>${project.artifactId}</finalName>
+    </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/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
new file mode 100644
index 0000000..5a048df
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/AuthenticationListener.java
@@ -0,0 +1,47 @@
+/*
+ * 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.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 javax.enterprise.event.Observes;
+import javax.inject.Inject;
+
+public class AuthenticationListener
+{
+
+    @Inject
+    private ViewNavigationHandler viewNavigationHandler;
+
+    @Inject
+    private LoggedInAccessDecisionVoter loggedInAccessDecisionVoter;
+
+    public void handleLoggedIn(@Observes LoggedInEvent event)
+    {
+        this.viewNavigationHandler.navigateTo(loggedInAccessDecisionVoter.getDeniedPage());
+    }
+
+    public void handleFailed(@Observes LoginFailedEvent event)
+    {
+        this.viewNavigationHandler.navigateTo(Pages.Login.class);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/Initializer.java
----------------------------------------------------------------------
diff --git a/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/Initializer.java b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/Initializer.java
new file mode 100644
index 0000000..4498ab8
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/Initializer.java
@@ -0,0 +1,57 @@
+/*
+ * 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.deltaspike.example.security.requestedpage.picketlink;
+
+import org.picketlink.idm.IdentityManager;
+import org.picketlink.idm.PartitionManager;
+import org.picketlink.idm.credential.Password;
+import org.picketlink.idm.model.basic.User;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Singleton;
+import javax.ejb.Startup;
+import javax.inject.Inject;
+
+/**
+ * This startup bean creates the default users, groups and roles when the application is started.
+ */
+@Singleton
+@Startup
+public class Initializer
+{
+
+    @Inject
+    private PartitionManager partitionManager;
+
+    @PostConstruct
+    public void create() {
+
+        // Create user john
+        User john = new User("john");
+        john.setEmail("john@acme.com");
+        john.setFirstName("John");
+        john.setLastName("User");
+
+        IdentityManager identityManager = this.partitionManager.createIdentityManager();
+
+        identityManager.add(john);
+        identityManager.updateCredential(john, new Password("123456"));
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/LoggedInAccessDecisionVoter.java
----------------------------------------------------------------------
diff --git a/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/LoggedInAccessDecisionVoter.java b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/LoggedInAccessDecisionVoter.java
new file mode 100644
index 0000000..2abfeef
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/LoggedInAccessDecisionVoter.java
@@ -0,0 +1,76 @@
+/*
+ * 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.deltaspike.example.security.requestedpage.picketlink;
+
+import org.apache.deltaspike.core.api.config.view.ViewConfig;
+import org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;
+import org.apache.deltaspike.security.api.authorization.AbstractAccessDecisionVoter;
+import org.apache.deltaspike.security.api.authorization.AccessDecisionVoterContext;
+import org.apache.deltaspike.security.api.authorization.SecurityViolation;
+import org.picketlink.Identity;
+
+import javax.enterprise.context.SessionScoped;
+import javax.faces.context.FacesContext;
+import javax.inject.Inject;
+import java.util.Set;
+
+@SessionScoped //or @WindowScoped
+public class LoggedInAccessDecisionVoter extends AbstractAccessDecisionVoter
+{
+
+    @Inject
+    private ViewConfigResolver viewConfigResolver;
+
+    @Inject
+    private Identity identity;
+
+    // set a default
+    private Class<? extends ViewConfig> deniedPage = Pages.Secure.Home.class;
+
+    @Override
+    protected void checkPermission(AccessDecisionVoterContext context, Set<SecurityViolation> violations)
+    {
+
+        if (identity.isLoggedIn())
+        {
+            // no violations, pass
+        }
+        else
+        {
+            violations.add(new SecurityViolation()
+            {
+                @Override
+                public String getReason()
+                {
+                    return "User must be logged in to access this resource";
+                }
+            });
+
+            // remember the requested page
+            deniedPage = viewConfigResolver
+                    .getViewConfigDescriptor(FacesContext.getCurrentInstance().getViewRoot().getViewId())
+                    .getConfigClass();
+        }
+    }
+
+    public Class<? extends ViewConfig> getDeniedPage()
+    {
+        return deniedPage;
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/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
new file mode 100644
index 0000000..973968f
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/java/org/apache/deltaspike/example/security/requestedpage/picketlink/Pages.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.deltaspike.example.security.requestedpage.picketlink;
+
+import org.apache.deltaspike.core.api.config.view.DefaultErrorView;
+import org.apache.deltaspike.core.api.config.view.ViewConfig;
+import org.apache.deltaspike.jsf.api.config.view.Folder;
+import org.apache.deltaspike.security.api.authorization.Secured;
+
+@Folder(name = "/")
+public interface Pages
+{
+    class Login extends DefaultErrorView
+    {
+    }
+
+    @Folder(name = "/secured")
+    interface Secure
+    {
+
+        @Secured(LoggedInAccessDecisionVoter.class)
+        class Home implements ViewConfig
+        {
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/WEB-INF/beans.xml
----------------------------------------------------------------------
diff --git a/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/WEB-INF/beans.xml b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..d2acfab
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,26 @@
+<!--
+    JBoss, Home of Professional Open Source
+    Copyright 2014, Red Hat, Inc. and/or its affiliates, and individual
+    contributors by the @authors tag. See the copyright.txt in the
+    distribution for a full listing of individual contributors.
+
+    Licensed 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.
+-->
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="
+      http://java.sun.com/xml/ns/javaee
+      http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+
+    <interceptors>
+        <class>org.apache.deltaspike.security.impl.extension.SecurityInterceptor</class>
+    </interceptors>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/WEB-INF/faces-config.xml
----------------------------------------------------------------------
diff --git a/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/WEB-INF/faces-config.xml b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..cce0e2f
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config
+    xmlns="http://java.sun.com/xml/ns/javaee"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd"
+    version="2.1">
+
+</faces-config>

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/WEB-INF/web.xml b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..23eddbc
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+	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.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+         version="3.0">
+
+    <context-param>
+        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+        <param-value>.xhtml</param-value>
+    </context-param>
+
+    <servlet>
+        <servlet-name>Faces Servlet</servlet-name>
+        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>Faces Servlet</servlet-name>
+        <url-pattern>*.xhtml</url-pattern>
+    </servlet-mapping>
+
+    <welcome-file-list>
+        <welcome-file>index.html</welcome-file>
+    </welcome-file-list>
+</web-app>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/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
new file mode 100644
index 0000000..d252a75
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/index.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>Index</title>
+</head>
+<body>
+<h1>Index</h1>
+
+<p>
+    This link points to a secured page and should redirect to login page:
+    <br>
+    <a href="secured/home.xhtml">Go Home</a>
+</p>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/login.xhtml
----------------------------------------------------------------------
diff --git a/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/login.xhtml b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/login.xhtml
new file mode 100644
index 0000000..ee692ee
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/login.xhtml
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:h="http://java.sun.com/jsf/html">
+<head>
+    <title>Login</title>
+</head>
+
+<body>
+<h1>Log in</h1>
+<h:messages globalOnly="true"></h:messages>
+<h:form id="loginForm">
+    <h:outputLabel value="Username:" for="username"/><br/>
+    <h:inputText value="#{loginCredentials.userId}" id="username"/><br/><br/>
+    <h:outputLabel value="Password:" for="password"/><br/>
+    <h:inputSecret value="#{loginCredentials.password}" id="password"/><br/>
+    <h:commandButton value="Log in" action="#{identity.login()}" id="loginBtn"/>
+</h:form>
+
+<p>
+    <b>Hint:</b> log in as john / 123456
+</p>
+<br/>
+
+</body>
+
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/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
new file mode 100644
index 0000000..29a101f
--- /dev/null
+++ b/deltaspike/examples/security-requested-page-after-login-picketlink/src/main/webapp/secured/home.xhtml
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <title>Home Page</title>
+</head>
+
+<body>
+<h1>Hello!</h1>
+
+<p>Welcome Home</p>
+
+</body>
+
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/documentation/src/main/asciidoc/bean-validation.adoc
----------------------------------------------------------------------
diff --git a/documentation/src/main/asciidoc/bean-validation.adoc b/documentation/src/main/asciidoc/bean-validation.adoc
index f471dbe..1ffccc6 100644
--- a/documentation/src/main/asciidoc/bean-validation.adoc
+++ b/documentation/src/main/asciidoc/bean-validation.adoc
@@ -8,7 +8,7 @@
 == Overview
 The Bean Validation module provides CDI integration for bean validation. It enables the creation of CDI-aware `ConstraintValidator` methods that can use business objects (EJBs, ManagedBeans) to support validation needs.
 
-== Configure Your Projects
+== Project Setup
 The configuration information provided here is for Maven-based projects and it assumes that you have already declared the DeltaSpike version and DeltaSpike Core module for your projects, as detailed in <<configure#, Configure DeltaSpike in Your Projects>>. For Maven-independent projects, see <<configure#config-maven-indep,Configure DeltaSpike in Maven-independent Projects>>.
 
 === Declare Bean Validation Module Dependencies
@@ -24,15 +24,13 @@ Add the Bean Validation module to the list of dependencies in the project `pom.x
 </dependency>
 ----
 
-== Use the Module Features
-
-=== Scoping
+== Scoping
 
 A `ConstraintValidator` inherits the scope defined in the bean class.
 
 NOTE: A `ConstraintValidator` may be invoked by multiple threads. For this reason, you should consider using at least `RequestScoped` validators.
 
-=== Code Requirements
+== Code Requirements
 
 There are no compile dependencies to use the Bean Validation module. You
 simply need to override the factory. Then you can build your `ConstraintValidator` based on CDI programming rules.

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/documentation/src/main/asciidoc/container-control.adoc
----------------------------------------------------------------------
diff --git a/documentation/src/main/asciidoc/container-control.adoc b/documentation/src/main/asciidoc/container-control.adoc
index 3b31c21..fa5ac18 100644
--- a/documentation/src/main/asciidoc/container-control.adoc
+++ b/documentation/src/main/asciidoc/container-control.adoc
@@ -5,7 +5,7 @@
 == Overview
 The Container Control module provides CDI container booting and shutdown, crucial for CDI use in Java SE6+ environments, and associated context lifecycle management. The module abstracts individual CDI container implementations, ensuring projects are container-independent.
 
-== Configure Your Projects
+== Project Setup
 The configuration information provided here is for Maven-based projects and it assumes that you have already declared the DeltaSpike version and DeltaSpike Core module for your projects, as detailed in <<configure#, Configure DeltaSpike in Your Projects>>. For Maven-independent projects, see <<configure#config-maven-indep,Configure DeltaSpike in Maven-independent Projects>>.
 
 === Enable CDI For Your Java Environment
@@ -24,9 +24,7 @@ Add the Container Control module to the list of dependencies in the project `pom
 </dependency>
 ----
 
-== Use the Module Features
-
-=== Start the CDI Container from Your Project
+== Start the CDI Container from Your Project
 To start a CDI container in your application, you must instantiate a `CdiContainer` object and call the `#boot` method. When `#boot` is called, the `CdiContainer` scans CDI-enabled
 archives for beans and CDI extensions. Before the application exits, `#shutdown` must be called to correctly destroy all beans. An example is given in the code snippet here.
 
@@ -81,17 +79,17 @@ To resolve project beans, you can use the DeltaSpike `BeanProvider` class. Wheth
 EchoService echoService = BeanProvider.getContextualReference(EchoService.class, false);
 ----
 
-=== CdiContainer
+== CdiContainer
 The `CdiContainer` interface provides booting and shutdown of the CDI containers from deployed applications, with `CdiContainerLoader` a simple factory providing access to the underlying `CdiContainer` implementation.
 
 This is useful to Java SE6+ applications in which a standalone CDI implementation must be provided and booted and shutdown by the application. Booting and shutdown of the CDI container for Java EE and servlet containers is managed by the servlet container integration.
 
 For instructions and examples on using this feature in your projects, see <<cdiimp#javase6,Enable CDI For Your Java Environment: Java SE6+>>.
 
-=== ContextControl Usage
+== ContextControl Usage
 The `ContextControl` interface provides life-cycle control of the CDI container built-in contexts. This includes starting and stoping built-in standard contexts like `@RequestScoped`, `@ConversationScoped`, and `@SessionScoped`. It is provided as an `@Dependent` bean and can be injected in the classic CDI way. This feature can be used and is helpful in all Java environments, including Java SE, as illustrated here.
 
-=== Procedure for builing Uber jar
+== Procedure for building an uber jar
 Uber jar or executable jar can created by using the maven shade plugin. Some things you needs to be aware of when you use it.
 
 * Multiple `beans.xml` and `javax.enterprise.inject.spi.Extension` files needs to be merged into the final jar using a transformer.
@@ -102,7 +100,7 @@ Uber jar or executable jar can created by using the maven shade plugin. Some thi
 * The _asm:asm:3.3.1_ transitive dependency of OpenWebBeans isn't properly included in the Uber jar.  Add it as a project dependency if you use OWB. (Only needed for OWB 1.1.8 !)
 * Some frameworks, like logging frameworks, aren't CDI compatible.  So you need to exclude them from scanning. Use for example the `scan` feature of Weld to define which packages needs to be excluded.
 
-==== Restart the RequestContext in Unit Tests
+=== Restart the RequestContext in Unit Tests
 In unit testing it can be necessary to test with attached and also with
 detached JPA entities. A very common approach for JPA is the
 http://docs.redhat.com/docs/en-US/JBoss_Enterprise_Web_Server/1.0/html/Hibernate_Entity_Manager_Reference_Guide/transactions.html[entitymanager-per-request
@@ -132,7 +130,7 @@ public void testMyBusinessLogic()
 }
 ---------------------------------------------------------------------------------------
 
-==== Attach a RequestContext to a New Thread in EE
+=== Attach a RequestContext to a New Thread in EE
 Accessing the `@RequestScoped` bean in a new thread will result in a
 `ContextNotActiveException`. The RequestContext usually gets started
 for a particular thread via a simple `ServletRequestListener`. So "no
@@ -165,7 +163,7 @@ public class CdiJob implements org.quartz.Job
 }
 ---------------------------------------------------------------------------------------------
 
-=== Embedded Servlet Support
+== Embedded Servlet Support
 From DeltaSpike 1.0.2, you can use DeltaSpike to power embedded Servlet
 runtimes. This work is done via Servlet Listeners. The configuration is
 specific to each container, below are some examples.
@@ -188,7 +186,7 @@ cdiContainer.boot();
 cdiContainer.getContextControl().startContexts();
 -----------------------------------------------------------------
 
-==== Jetty
+=== Jetty
 
 For Jetty, you need to add an `EventListener` which will be your
 `CdiServletRequestListener`. The object must be instantiated. This must
@@ -207,7 +205,7 @@ context.addServlet(new ServletHolder(new YourServlet()),"/*");
 server.start();
 ------------------------------------------------------------------------------------------
 
-==== Undertow
+=== Undertow
 
 For Undertow, you register the `CdiServletRequestListener` via
 `ListenerInfo` by passing in the class to their builders. Then you add
@@ -232,7 +230,7 @@ Undertow server = Undertow.builder()
 server.start();
 --------------------------------------------------------------------------------------------------------
 
-==== Tomcat
+=== Tomcat
 
 For Tomcat, you need to register the `CdiServletContextListener` instead
 of the `CdiServletRequestListener`. It is added as an

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/documentation/src/main/asciidoc/data.adoc
----------------------------------------------------------------------
diff --git a/documentation/src/main/asciidoc/data.adoc b/documentation/src/main/asciidoc/data.adoc
index 4786dab..e0f3ec4 100644
--- a/documentation/src/main/asciidoc/data.adoc
+++ b/documentation/src/main/asciidoc/data.adoc
@@ -42,7 +42,7 @@ extension. A client can declare a dependency to the interface only. The
 details on how to use those features are outlines in the following
 chapters.
 
-== Configure Your Projects
+== Project Setup
 
 The configuration information provided here is for Maven-based projects and it assumes that you have already declared the DeltaSpike version and DeltaSpike Core module for your projects, as detailed in <<configure#, Configure DeltaSpike in Your Projects>>. For Maven-independent projects, see <<configure#config-maven-indep,Configure DeltaSpike in Maven-independent Projects>>.
 
@@ -126,14 +126,12 @@ configure the `TransactionStrategy` your repositories use. Adapt your
 </beans>
 ----
 
-== Use the Module Features
-
 IMPORTANT: Using the DeltaSpike Data module in an EAR deployment is currently restricted to
 annotation-based entities.
 
-=== Core Concepts
+== Core Concepts
 
-==== Repositories
+=== Repositories
 
 With the DeltaSpike Data module, it is possible to make a repository out
 of basically any abstract class or interface (using a concrete class
@@ -162,7 +160,7 @@ classes or interfaces this is the only way to tell the framework what
 entity the repository relates to. In order to simplify this, DeltaSpike
 Data provides several base types.
 
-===== The `EntityRepository` Interface
+==== The `EntityRepository` Interface
 
 Although mainly intended to hold complex query logic, working with both
 a repository and an `EntityManager` in the service layer might
@@ -245,7 +243,7 @@ public abstract class PersonRepository extends AbstractEntityRepository<Person,
 }
 -------------------------------------------------------------------------------------
 
-==== Deactivating Repositories
+=== Deactivating Repositories
 
 Repositories can be deactivated creating a <<spi.adoc#_classdeactivator,ClassDeactivator>>.
 
@@ -266,7 +264,7 @@ public interface PersonRepository implements Deactivatable{
 }    
 ----------------------------------------
 
-==== Using Multiple `EntityManager`
+=== Using Multiple `EntityManager`
 
 While most applications will run just fine with a single
 `EntityManager`, there might be setups where multiple data sources are
@@ -299,7 +297,7 @@ possible to create something like a base `CrmRepository` interface with
 the `@EntityManagerConfig` and then extending / implementing this
 interface.
 
-==== Other `EntityManager` Methods
+=== Other `EntityManager` Methods
 
 While the `EntityRepository` methods should cover most interactions
 normally done with an `EntityManager`, for some specific cases it might
@@ -317,14 +315,14 @@ public interface PersonRepository extends EntityRepository<Person, Long>, Entity
 }
 -------------------------------------------------------------------------------------------------------
 
-=== Query Method Expressions
+== Query Method Expressions
 
 Good naming is a difficult aspects in software engineering. A good
 method name usually makes comments unnecessary and states exactly what
 the method does. And with method expressions, the method name is
 actually the implementation!
 
-==== Using Method Expressions
+=== Using Method Expressions
 
 Let's start by looking at a (simplified for readability) example:
 
@@ -395,7 +393,7 @@ Note that DeltaSpike will validate those expressions during startup, so
 you will notice early in case you have a typo in those expressions.
 
 
-==== Query Ordering
+=== Query Ordering
 
 Beside comparators it is also possible to sort queries by using the
 `OrderBy` keyword, followed by the attribute name and the direction
@@ -412,7 +410,7 @@ public interface PersonRepository extends EntityRepository<Person, Long>
 } 
 ------------------------------------------------------------------------------
 
-==== Nested Properties
+=== Nested Properties
 
 To create a comparison on a nested property, the traversal parts can be
 separated by a `_`:
@@ -428,7 +426,7 @@ public interface PersonRepository extends EntityRepository<Person, Long>
 }
 ------------------------------------------------------------------------
 
-==== Query Options
+=== Query Options
 
 
 DeltaSpike supports query options on method expressions. If you want to
@@ -446,7 +444,7 @@ public interface PersonRepository extends EntityRepository<Person, Long>
 }
 -----------------------------------------------------------------------------------------------
 
-==== Method Prefix
+=== Method Prefix
 
 In case the `findBy` prefix does not comply with your team conventions,
 this can be adapted:
@@ -462,7 +460,7 @@ public interface PersonRepository extends EntityRepository<Person, Long>
 }
 --------------------------------------------------------------------------------------------------
 
-=== Query Annotations
+== Query Annotations
 
 While method expressions are fine for simple queries, they will often
 reach their limit once things get slightly more complex. Another aspect
@@ -472,7 +470,7 @@ cases, the DeltaSpike Data module supports also annotating methods for
 more control on the generated query.
 
 
-==== Using Query Annotations
+=== Using Query Annotations
 
 The simples way to define a specific query is by annotating a method and
 providing the JPQL query string which has to be executed. In code, this
@@ -569,7 +567,7 @@ public interface PersonRepository extends EntityRepository<Person, Long>
 }
 ------------------------------------------------------------------------------------
 
-==== Annotation Options
+=== Annotation Options
 
 Beside providing a query string or reference, the `@Query` annotation
 provides also two more attributes:
@@ -595,7 +593,7 @@ public interface PersonRepository extends EntityRepository<Person, Long>
 
 Note that these options can also be applied to method expressions.
 
-==== Query Options
+=== Query Options
 
 All the query options you have seen so far are more or less static. But
 sometimes you might want to apply certain query options dynamically. For
@@ -635,7 +633,7 @@ supported for Hibernate, EclipseLink and OpenJPA.
 Note that the `QueryResult` return type can also be used with method
 expressions.
 
-==== Pagination
+=== Pagination
 
 We introduced the `QueryResult` type in the last chapter, which can also
 be used for pagination:
@@ -655,7 +653,7 @@ QueryResult<Person> paged = personRepository.findByAge(age)
 int totalPages = paged.countPages();
 -----------------------------------------------------------
 
-==== Bulk Operations
+=== Bulk Operations
 
 While reading entities and updating them one by one might be fine for
 many use cases, applying bulk updates or deletes is also a common usage
@@ -678,7 +676,7 @@ public interface PersonRepository extends EntityRepository<Person, Long>
 Bulk operation query methods can either return void or int, which counts
 the number of entities affected by the bulk operation.
 
-==== Optional Query Results
+=== Optional Query Results
 
 The JPA spec requires to throw exceptions in case the
 `getSingleResult()` method does either return no or more than one
@@ -690,7 +688,7 @@ DeltaSpike Data gives the option to change this to the way it makes most
 sense for the current usecase. While the default behavior is still fully
 aligned with JPA, it is also possible to request optional query results.
 
-==== Zero or One Result
+=== Zero or One Result
 
 With this option, the query returns `null` instead of throwing a
 `NoResultException` when there is no result returned. It is usable with
@@ -717,7 +715,7 @@ with the `SingleResultType.OPTIONAL` enum.
 In case the query returns more than one result, a
 `NonUniqueResultException` is still thrown.
 
-==== Any Result
+=== Any Result
 
 If the caller does not really mind what kind if result is returned, it is
 also possible to request any result from the query. If there is no
@@ -745,7 +743,7 @@ annotations, the `singleResult` attribute can be overridden with the
 
 This option will not throw an exception.
 
-=== Transactions
+== Transactions
 
 If you call any method expression, `@Query`-annotated method or a method
 from the `EntityRepository`, the repository will figure out if a
@@ -787,9 +785,9 @@ Repositories can then implement the `TxRepository` interface and call
 their queries in the `transactional` method (where the callback
 implementation can be, for example, in an anonymous class).
 
-=== Extensions
+== Extensions
 
-==== Query Delegates
+=== Query Delegates
 
 While repositories defines several base interfaces, there might still be
 the odd convenience method that is missing. This is actually intentional
@@ -815,7 +813,7 @@ public interface PersonRepository extends QueryDslSupport
 }   
 ---------------------------------------------------------
 
-==== Implementing the Query Delegate
+=== Implementing the Query Delegate
 
 The first step is to define an interface which contains the extra
 methods for your repositories (as shown above):
@@ -858,7 +856,7 @@ Note that, if you define multiple extensions with equivalent method
 signatures, there is no specific order in which the implementation is
 selected.
 
-=== Mapping
+== Mapping
 
 While repositories are primarily intended to work with Entities, it
 might be preferable in some cases to have an additional mapping layer on
@@ -948,7 +946,7 @@ is mandatory. Also it is up to the mapper to convert parameters
 correctly (in this example, a conversion from a `PersonDto` parameter to
 `Person` entity and from `PersonId` to `Long` is necessary).
 
-==== Simple Mappings
+=== Simple Mappings
 
 In many cases it is just required to map a DTO object back and forth. For
 this case, the `SimpleQueryInOutMapperBase` class can be subclassed,
@@ -988,7 +986,7 @@ created. In any case, there is no need to map the primary key to the
 entity (it either does not exist or is already populated for an existing
 entity).
 
-=== JPA Criteria API Support
+== JPA Criteria API Support
 
 Beside automatic query generation, the DeltaSpike Data module also
 provides a DSL-like API to create JPA 2 Criteria queries. It takes
@@ -1006,7 +1004,7 @@ strongest point is certainly its type safety - which comes at the cost
 of readability. We're trying to provide a middle way here. A less
 powerful API, but still type safe and readable.
 
-==== API Usage
+=== API Usage
 
 The API is centered around the Criteria class and is targeted to provide
 a fluent interface to write criteria queries:
@@ -1065,7 +1063,7 @@ Once all comparators and query options are applied, the `createQuery()`
 method is called. This creates a JPA TypedQuery object for the
 repository entity. If required, further processing can be applied here.
 
-==== Joins
+=== Joins
 
 For simple cases, restricting on the repository entity only works out
 fine, but once the Data model gets more complicated, the query will have
@@ -1112,7 +1110,7 @@ public abstract class PersonRepository extends AbstractEntityRepository<Person,
 }
 -------------------------------------------------------------------------------------
 
-==== Boolean Operators
+=== Boolean Operators
 
 By default, all query operators are concatenated as an and conjunction
 to the query. The DeltaSpike criteria API also allows to add groups of
@@ -1140,7 +1138,7 @@ public abstract class PersonRepository extends AbstractEntityRepository<Person,
 }
 -------------------------------------------------------------------------------------
 
-==== Selections
+=== Selections
 
 It might not always be appropriate to retrieve full entities - you might
 also be interested in scalar values or by modified entity attributes.
@@ -1194,7 +1192,7 @@ selection clause:
 |===
 
 
-=== Auditing
+== Auditing
 
 A common requirement for entities is tracking what is being done with
 them. DeltaSpike provides a convenient way to support this requirement.
@@ -1202,7 +1200,7 @@ them. DeltaSpike provides a convenient way to support this requirement.
 NOTE: DeltaSpike does not support creating revisions of entities. If this is a
 requirement for your audits, have a look at Hibernate Envers.
 
-==== Activating Auditing
+=== Activating Auditing
 
 DeltaSpike uses an entity listener to update auditing data before
 entities get created or update. The entity listener must be activated
@@ -1244,12 +1242,12 @@ Note that for this variant, you need a compile dependency on the impl
 module. Alternatively, also the per entity listener can be configured by
 XML.
 
-==== Using Auditing Annotations
+=== Using Auditing Annotations
 
 All that has to be done now is annotating the entity properties which
 are used to audit the entity.
 
-===== Updating Timestamps
+====  Updating Timestamps
 
 To keep track on creation and modification times, following annotations
 can be used:
@@ -1282,7 +1280,7 @@ the annotation can be customized:
 @ModifiedOn(setOnCreate=true)
 -----------------------------
 
-===== Who's Changing My Entities?
+====  Who's Changing My Entities?
 
 Beside keeping track of when a change has happened, it is also often
 critical to track who's responsible for the change. Annotate a user

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e67d64a2/documentation/src/main/asciidoc/jpa.adoc
----------------------------------------------------------------------
diff --git a/documentation/src/main/asciidoc/jpa.adoc b/documentation/src/main/asciidoc/jpa.adoc
index 5ba3f6a..f7d8943 100644
--- a/documentation/src/main/asciidoc/jpa.adoc
+++ b/documentation/src/main/asciidoc/jpa.adoc
@@ -8,7 +8,7 @@
 == Overview
 The JPA module provides a transactional context and scope, enabling execution of methods within transactions.
 
-== Configure Your Projects
+== Project Setup
 The configuration information provided here is for Maven-based projects and it assumes that you have already declared the DeltaSpike version and DeltaSpike Core module for your projects, as detailed in <<configure#, Configure DeltaSpike in Your Projects>>. For Maven-independent projects, see <<configure#config-maven-indep,Configure DeltaSpike in Maven-independent Projects>>.
 
 === 1. Declare JPA Module Dependencies
@@ -44,9 +44,7 @@ For CDI 1.0 (or DeltaSpike v1.1.0 and earlier together with CDI 1.1+), you must
 </beans>
 ----
 
-== Use the Module Features
-
-=== @Transactional
+== @Transactional
 
 This annotation is an alternative to transactional EJBs which allows to
 execute a method within a transaction. Before it is possible to start
@@ -337,7 +335,7 @@ a different `EntityManager`. So it is possible to catch an exception in
 `FirstLevelTransactionBean`, for example, to try an optional path instead of an
 immediate rollback.
 
-=== @TransactionScoped
+== @TransactionScoped
 
 `@Transactional` also starts a context which is available as long as the
 transaction started by `@Transactional`. Besides other beans you can use
@@ -373,7 +371,7 @@ public class EntityManagerProducer
 }
 ----------------------------------------------------------------------------
 
-=== Extended Persistence Contexts
+== Extended Persistence Contexts
 
 Frameworks like MyFaces Orchestra provide a feature which allows keeping
 an `EntityManager` across multiple requests. That means it is not
@@ -493,7 +491,7 @@ to merge detached entities automatically if those entities get
 serialized as well. However, as mentioned before *we do not recommend*
 such an approach.
 
-=== JTA Support
+== JTA Support
 
 By default the transaction-type used by `@Transactional` is
 `RESOURCE_LOCAL`. If you configure `transaction-type="JTA"` in the