diff --git a/spring-security-login-error-handling/src/main/java/org/baeldung/persistence/model/Role.java b/spring-security-login-error-handling/src/main/java/org/baeldung/persistence/model/Role.java index 7fcfce196a..bb4b86e32f 100644 --- a/spring-security-login-error-handling/src/main/java/org/baeldung/persistence/model/Role.java +++ b/spring-security-login-error-handling/src/main/java/org/baeldung/persistence/model/Role.java @@ -66,4 +66,33 @@ public class Role { public void setRole(Integer role) { this.role = role; } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((role == null) ? 0 : role.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final Role role = (Role) obj; + if (!role.equals(role.role)) + return false; + return true; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(); + builder.append("Role [role=").append(role).append("]").append("[id=").append(id).append("]"); + return builder.toString(); + } } \ No newline at end of file diff --git a/spring-security-login-error-handling/src/main/resources/application.properties b/spring-security-login-error-handling/src/main/resources/application.properties index 425018eea6..bcff123738 100644 --- a/spring-security-login-error-handling/src/main/resources/application.properties +++ b/spring-security-login-error-handling/src/main/resources/application.properties @@ -1,11 +1,10 @@ ################### DataSource Configuration ########################## jdbc.driverClassName=com.mysql.jdbc.Driver -jdbc.url=jdbc:mysql://localhost:3306/spring_hibernate4_02?createDatabaseIfNotExist=true +jdbc.url=jdbc:mysql://localhost:3306/AUTHDATA jdbc.user=tutorialuser jdbc.pass=tutorialmy5ql init-db=false ################### Hibernate Configuration ########################## hibernate.dialect=org.hibernate.dialect.MySQLDialect -hibernate.show_sql=false -hibernate.hbm2ddl.auto=create-drop - +hibernate.show_sql=true +hibernate.hbm2ddl.auto=validate \ No newline at end of file diff --git a/spring-security-login-error-handling/src/main/webapp/WEB-INF/view/admin.jsp b/spring-security-login-error-handling/src/main/webapp/WEB-INF/view/admin.jsp index 923971cb08..3b88dbdb12 100644 --- a/spring-security-login-error-handling/src/main/webapp/WEB-INF/view/admin.jsp +++ b/spring-security-login-error-handling/src/main/webapp/WEB-INF/view/admin.jsp @@ -1,18 +1,16 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> -<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%> +<%@ taglib prefix="sec" + uri="http://www.springframework.org/security/tags"%> <%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> - - - + " rel="stylesheet"> -<<<<<<< HEAD -======= - ->>>>>>> FETCH_HEAD + + +

Hello Admin

diff --git a/spring-security-login-error-handling/src/main/webapp/WEB-INF/view/console.jsp b/spring-security-login-error-handling/src/main/webapp/WEB-INF/view/console.jsp index 2243df768c..f6ab8b6121 100644 --- a/spring-security-login-error-handling/src/main/webapp/WEB-INF/view/console.jsp +++ b/spring-security-login-error-handling/src/main/webapp/WEB-INF/view/console.jsp @@ -1,20 +1,20 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> -<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags"%> +<%@ taglib prefix="sec" + uri="http://www.springframework.org/security/tags"%> - " rel="stylesheet">

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 diff --git a/spring-security-login-error-handling/src/main/webapp/WEB-INF/view/homepage.jsp b/spring-security-login-error-handling/src/main/webapp/WEB-INF/view/homepage.jsp index 9b6502c907..4fb2853ef1 100644 --- a/spring-security-login-error-handling/src/main/webapp/WEB-INF/view/homepage.jsp +++ b/spring-security-login-error-handling/src/main/webapp/WEB-INF/view/homepage.jsp @@ -1,10 +1,5 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> -<<<<<<< HEAD -<%@ taglib prefix="sec" - uri="http://www.springframework.org/security/tags"%> -======= <%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%> ->>>>>>> FETCH_HEAD <%@ page session="true"%> @@ -27,8 +22,4 @@ ">Home ">Administrator Page -<<<<<<< HEAD -======= - ->>>>>>> FETCH_HEAD \ No newline at end of file diff --git a/spring-security-login-error-handling/src/main/webapp/WEB-INF/view/login.jsp b/spring-security-login-error-handling/src/main/webapp/WEB-INF/view/login.jsp index ecc8965f7d..626554b4af 100644 --- a/spring-security-login-error-handling/src/main/webapp/WEB-INF/view/login.jsp +++ b/spring-security-login-error-handling/src/main/webapp/WEB-INF/view/login.jsp @@ -4,7 +4,6 @@ <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> <%@ page session="true"%> - diff --git a/spring-security-login-error-handling/src/main/webapp/WEB-INF/view/logout.jsp b/spring-security-login-error-handling/src/main/webapp/WEB-INF/view/logout.jsp index d87e41fc6c..f33773b217 100644 --- a/spring-security-login-error-handling/src/main/webapp/WEB-INF/view/logout.jsp +++ b/spring-security-login-error-handling/src/main/webapp/WEB-INF/view/logout.jsp @@ -1,7 +1,6 @@ <%@ 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"%> -