From b27187d120795750080718be04fab167f8dd1c26 Mon Sep 17 00:00:00 2001 From: egmp777 Date: Tue, 22 Jul 2014 17:44:45 -0500 Subject: [PATCH] Login and Registration Error Handling pom changes POM Changes --- .../bin/.springBeans | 15 ++++ .../{ => bin}/pom.xml | 0 .../bin/src/main/resources/logback.xml | 20 +++++ .../src/main/resources/messages_en.properties | 9 +++ .../main/resources/messages_es_ES.properties | 9 +++ .../src/main/resources/webSecurityConfig.xml | 36 +++++++++ .../src/main/webapp/WEB-INF/mvc-servlet.xml | 10 +++ .../src/main/webapp/WEB-INF/view/admin.jsp | 23 ++++++ .../src/main/webapp/WEB-INF/view/console.jsp | 23 ++++++ .../bin/src/main/webapp/WEB-INF/view/home.jsp | 13 ++++ .../src/main/webapp/WEB-INF/view/homepage.jsp | 28 +++++++ .../webapp/WEB-INF/view/invalidSession.jsp | 12 +++ .../src/main/webapp/WEB-INF/view/login.jsp | 77 +++++++++++++++++++ .../src/main/webapp/WEB-INF/view/logout.jsp | 24 ++++++ .../main/webapp/WEB-INF/view/registration.jsp | 12 +++ .../bin/src/main/webapp/WEB-INF/web.xml | 41 ++++++++++ 16 files changed, 352 insertions(+) create mode 100644 spring-security-login-error-handling/bin/.springBeans rename spring-security-login-error-handling/{ => bin}/pom.xml (100%) create mode 100644 spring-security-login-error-handling/bin/src/main/resources/logback.xml create mode 100644 spring-security-login-error-handling/bin/src/main/resources/messages_en.properties create mode 100644 spring-security-login-error-handling/bin/src/main/resources/messages_es_ES.properties create mode 100644 spring-security-login-error-handling/bin/src/main/resources/webSecurityConfig.xml create mode 100644 spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/mvc-servlet.xml create mode 100644 spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/admin.jsp create mode 100644 spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/console.jsp create mode 100644 spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/home.jsp create mode 100644 spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/homepage.jsp create mode 100644 spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/invalidSession.jsp create mode 100644 spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/login.jsp create mode 100644 spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/logout.jsp create mode 100644 spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/registration.jsp create mode 100644 spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/web.xml diff --git a/spring-security-login-error-handling/bin/.springBeans b/spring-security-login-error-handling/bin/.springBeans new file mode 100644 index 0000000000..8096aa036b --- /dev/null +++ b/spring-security-login-error-handling/bin/.springBeans @@ -0,0 +1,15 @@ + + + 1 + + + + + + + + + + + + diff --git a/spring-security-login-error-handling/pom.xml b/spring-security-login-error-handling/bin/pom.xml similarity index 100% rename from spring-security-login-error-handling/pom.xml rename to spring-security-login-error-handling/bin/pom.xml diff --git a/spring-security-login-error-handling/bin/src/main/resources/logback.xml b/spring-security-login-error-handling/bin/src/main/resources/logback.xml new file mode 100644 index 0000000000..1146dade63 --- /dev/null +++ b/spring-security-login-error-handling/bin/src/main/resources/logback.xml @@ -0,0 +1,20 @@ + + + + + web - %date [%thread] %-5level %logger{36} - %message%n + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-security-login-error-handling/bin/src/main/resources/messages_en.properties b/spring-security-login-error-handling/bin/src/main/resources/messages_en.properties new file mode 100644 index 0000000000..3e05a6b76a --- /dev/null +++ b/spring-security-login-error-handling/bin/src/main/resources/messages_en.properties @@ -0,0 +1,9 @@ +message.username=Username required +message.password=Password required +message.unauth=Unauthorized Access !! +message.badCredentials=Invalid Username or Password +message.sessionExpired=Session Timed Out +message.logoutError=Sorry, error logging out +message.logoutSucc=You logged out successfully +message.regSucc=You registrated correctly, please log in +message.regError=There was a registration error please go back to registration \ No newline at end of file diff --git a/spring-security-login-error-handling/bin/src/main/resources/messages_es_ES.properties b/spring-security-login-error-handling/bin/src/main/resources/messages_es_ES.properties new file mode 100644 index 0000000000..842a899e43 --- /dev/null +++ b/spring-security-login-error-handling/bin/src/main/resources/messages_es_ES.properties @@ -0,0 +1,9 @@ +message.username=Por favor ingrese el nombre de usuario +message.password=Por favor ingrese una clave +message.unauth=Acceso denegado !! +message.badCredentials=Usuario o clave invalida +message.sessionExpired=La sesion expiro +message.logoutError=Lo sentimos, hubo problemas en logout +message.logoutSucc=Logout con exito +message.regSucc=Se registro correctamente, por favor ingrese +message.regError=Hubo un error, por favor vuelva a registrarse \ No newline at end of file diff --git a/spring-security-login-error-handling/bin/src/main/resources/webSecurityConfig.xml b/spring-security-login-error-handling/bin/src/main/resources/webSecurityConfig.xml new file mode 100644 index 0000000000..46550f03da --- /dev/null +++ b/spring-security-login-error-handling/bin/src/main/resources/webSecurityConfig.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/mvc-servlet.xml new file mode 100644 index 0000000000..b885d2c10a --- /dev/null +++ b/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/mvc-servlet.xml @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file diff --git a/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/admin.jsp b/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/admin.jsp new file mode 100644 index 0000000000..12f9f7aba9 --- /dev/null +++ b/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/admin.jsp @@ -0,0 +1,23 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %> +<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> + + + + + + + + + + + +

Hello Admin

+
+ + ">Logout + ">Home + + + + diff --git a/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/console.jsp b/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/console.jsp new file mode 100644 index 0000000000..05a930731b --- /dev/null +++ b/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/console.jsp @@ -0,0 +1,23 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %> + + + + +

This is the landing page for the admin

+ + + This text is only visible to a user +
+
+ + + This text is only visible to an admin +
+
+ + ">Logout + ">Administrator Page + + + \ No newline at end of file diff --git a/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/home.jsp b/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/home.jsp new file mode 100644 index 0000000000..fe6e572b99 --- /dev/null +++ b/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/home.jsp @@ -0,0 +1,13 @@ +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ page session="true" %> + + + Home + + +

+ Welcome back home! +

+ + + diff --git a/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/homepage.jsp b/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/homepage.jsp new file mode 100644 index 0000000000..fab96383df --- /dev/null +++ b/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/homepage.jsp @@ -0,0 +1,28 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %> +<%@ page session="true" %> + + + + + +

This is the homepage for the user

+ + + This text is only visible to a user +
+
+ + + This text is only visible to an admin +
+
+ + ">Logout + ">Home + ">Administrator Page + + + + + \ No newline at end of file diff --git a/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/invalidSession.jsp b/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/invalidSession.jsp new file mode 100644 index 0000000000..175c498117 --- /dev/null +++ b/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/invalidSession.jsp @@ -0,0 +1,12 @@ +<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> + + + Home + + +

+ +

+ + + diff --git a/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/login.jsp b/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/login.jsp new file mode 100644 index 0000000000..95559b0455 --- /dev/null +++ b/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/login.jsp @@ -0,0 +1,77 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="sec" + uri="http://www.springframework.org/security/tags"%> +<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> + +<%@ page session="false"%> + +
+ +
+
+ +
+ +
+
+ + +
+ +
+ Register +
+ + + + + + + + + +

Login

+ English | + Spanish +
+ + + + + + + + + + + + + +
User:
Password:
+ +
+
Current Locale : ${pageContext.response.locale} + + \ No newline at end of file diff --git a/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/logout.jsp b/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/logout.jsp new file mode 100644 index 0000000000..e8618b74e3 --- /dev/null +++ b/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/logout.jsp @@ -0,0 +1,24 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="sec" + uri="http://www.springframework.org/security/tags"%> +<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> + +
+ +
+
+ +
+ +
+
+ + + +Logged Out + + + + Login + + \ No newline at end of file diff --git a/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/registration.jsp b/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/registration.jsp new file mode 100644 index 0000000000..474a1817b5 --- /dev/null +++ b/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/view/registration.jsp @@ -0,0 +1,12 @@ +<%@ page language="java" contentType="text/html; charset=US-ASCII" + pageEncoding="US-ASCII"%> + + + + +Registration + + +

This is the registration page

+ + \ No newline at end of file diff --git a/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/web.xml b/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..463b309377 --- /dev/null +++ b/spring-security-login-error-handling/bin/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,41 @@ + + + + contextClass + + org.springframework.web.context.support.AnnotationConfigWebApplicationContext + + + + contextConfigLocation + org.baeldung.spring + + + org.springframework.web.context.ContextLoaderListener + + + mvc + org.springframework.web.servlet.DispatcherServlet + 1 + + + mvc + / + + + springSecurityFilterChain + org.springframework.web.filter.DelegatingFilterProxy + + + springSecurityFilterChain + /* + + + localizationFilter + org.springframework.web.filter.RequestContextFilter + + + localizationFilter + /* + + \ No newline at end of file