Skip to content
Snippets Groups Projects
Commit 74b33530 authored by Nils Christian Ehmke's avatar Nils Christian Ehmke
Browse files

Solved some security/redirecting issues with the root context; Corrected the...

Solved some security/redirecting issues with the root context; Corrected the login form; Corrected the link for the logout
parent b2a5f1be
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,8 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core">
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<f:metadata>
<f:viewParam id="state" name="state"/>
......@@ -31,11 +32,6 @@
<form action="#{request.contextPath}/j_spring_security_check" method="post">
<div class="stretch" align="center">
<div class="hint-panel">
<h:outputText style="color: red" value="#{state == 'logout' ? 'Sie haben sich erfolgreich ausgeloggt.' : 'Anmeldung fehlgeschlagen.'}" rendered="#{not empty state}"/><br/>
<p:spacer width="0" height="25" rendered="#{not empty state}"/>
</div>
<p:panel header="#{localizedLoginMessages.msgWelcomeShort}" styleClass="login-panel">
<h:panelGrid columnClasses="col1 , col2" styleClass="grid" columns="2" cellpadding="5" >
<h:outputLabel for="j_username" value="#{localizedLoginMessages.username}:" />
......@@ -46,12 +42,26 @@
</h:panelGrid>
<hr/>
<div align="right">
<h:commandButton value="#{localizedLoginMessages.login}" type="submit" />
<button type="submit" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">
<span class="ui-button-text">#{localizedLoginMessages.login}</span>
</button>
</div>
</p:panel>
<p:spacer width="0" height="40"/>
<c:if test="#{state == 'logout'}">
<div class="hint-panel">
<p:spacer width="0" height="25"/>
<h:outputText value="Sie haben sich erfolgreich ausgeloggt."/><br/>
</div>
</c:if>
<c:if test="#{state == 'fail'}">
<div class="hint-panel">
<p:spacer width="0" height="25" />
<h:outputText style="color: red" value="Anmeldung fehlgeschlagen."/><br/>
</div>
</c:if>
<p:spacer width="0" height="40"/>
<div class="hint-panel">
<h:outputText value="#{localizedLoginMessages.hint}"/>
</div>
......
......@@ -8,6 +8,12 @@
<view-id value="/faces/pages/ProjectOverviewPage.xhtml" />
</url-mapping>
<!-- The following mapping is very important! It makes sure that no one can access the root directory of the application. -->
<url-mapping id="home-redirect">
<pattern value="/" />
<view-id value="/faces/pages/ProjectOverviewPage.xhtml" />
</url-mapping>
<url-mapping id="projectOverview">
<pattern value="/pages/projectOverview" />
<view-id value="/faces/pages/ProjectOverviewPage.xhtml" />
......
......@@ -8,11 +8,11 @@
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">
<http use-expressions="true" access-denied-page="/accessDenied" >
<form-login login-page="/login" default-target-url="/pages/" authentication-failure-url="/login?state=failure"/>
<form-login login-page="/login" default-target-url="/pages/" authentication-failure-url="/login?state=fail"/>
<intercept-url pattern="/login" access="true"/>
<intercept-url pattern="/pages/**" access="isAuthenticated()"/>
<intercept-url pattern="/faces/pages/**" access="isAuthenticated()"/>
<intercept-url pattern="/" access="false" />
<intercept-url pattern="/" access="isAuthenticated()" />
<logout logout-success-url="/login?state=logout" />
</http>
......
......@@ -65,10 +65,6 @@
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/ProjectOverviewPage.xhtml</welcome-file>
</welcome-file-list>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
......
......@@ -114,7 +114,7 @@
<p:menuitem styleClass="element-with-whitespace" icon="ui-icon-about" value=" #{localizedMessages.about}" onclick="aboutDlg.show()" ajax="true"/>
</p:submenu>
<p:menuitem styleClass="logOutButton element-with-whitespace" icon="ui-icon-logout" value=" #{userBean.userName}" ajax="true" url="j_spring_security_logout"/>
<p:menuitem styleClass="logOutButton element-with-whitespace" icon="ui-icon-logout" value=" #{userBean.userName}" ajax="true" url="#{request.contextPath}/j_spring_security_logout"/>
</p:menubar>
<p:spacer height="5"/>
<p:menubar>
......
......@@ -68,7 +68,7 @@
<p:menuitem styleClass="element-with-whitespace" icon="ui-icon-about" value=" #{localizedMessages.about}" onclick="aboutDlg.show()" ajax="true"/>
</p:submenu>
<p:menuitem styleClass="logOutButton element-with-whitespace" icon="ui-icon-logout" value=" #{userBean.userName}" ajax="true" url="j_spring_security_logout"/>
<p:menuitem styleClass="logOutButton element-with-whitespace" icon="ui-icon-logout" value=" #{userBean.userName}" ajax="true" url="#{request.contextPath}/j_spring_security_logout"/>
</p:menubar>
</h:form>
</p:layoutUnit>
......
......@@ -66,7 +66,7 @@
<p:menuitem styleClass="element-with-whitespace" icon="ui-icon-about" value=" #{localizedMessages.about}" onclick="aboutDlg.show()" ajax="true"/>
</p:submenu>
<p:menuitem styleClass="logOutButton element-with-whitespace" icon="ui-icon-logout" value=" #{userBean.userName}" ajax="true" url="j_spring_security_logout"/>
<p:menuitem styleClass="logOutButton element-with-whitespace" icon="ui-icon-logout" value=" #{userBean.userName}" ajax="true" url="#{request.contextPath}/j_spring_security_logout"/>
</p:menubar>
</h:form>
</p:layoutUnit>
......
......@@ -61,7 +61,7 @@
<p:menuitem styleClass="element-with-whitespace" icon="ui-icon-about" value=" #{localizedMessages.about}" onclick="aboutDlg.show()" ajax="true"/>
</p:submenu>
<p:menuitem styleClass="logOutButton element-with-whitespace" icon="ui-icon-logout" value=" #{userBean.userName}" ajax="true" url="j_spring_security_logout"/>
<p:menuitem styleClass="logOutButton element-with-whitespace" icon="ui-icon-logout" value=" #{userBean.userName}" ajax="true" url="#{request.contextPath}/j_spring_security_logout"/>
</p:menubar>
</h:form>
......
......@@ -59,7 +59,7 @@
<p:menuitem styleClass="element-with-whitespace" icon="ui-icon-about" value=" #{localizedMessages.about}" onclick="aboutDlg.show()" ajax="true"/>
</p:submenu>
<p:menuitem styleClass="logOutButton element-with-whitespace" icon="ui-icon-logout" value=" #{userBean.userName}" ajax="true" url="j_spring_security_logout"/>
<p:menuitem styleClass="logOutButton element-with-whitespace" icon="ui-icon-logout" value=" #{userBean.userName}" ajax="true" url="#{request.contextPath}/j_spring_security_logout"/>
</p:menubar>
</h:form>
</p:layoutUnit>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment