Skip to content

Commit ac9b66d

Browse files
author
Eugen
committed
Merge pull request eugenp#39 from egmp777/master
New Cleanup
2 parents 75968ea + 2f22fea commit ac9b66d

File tree

7 files changed

+44
-29
lines changed

7 files changed

+44
-29
lines changed

spring-security-login-error-handling/src/main/java/org/baeldung/persistence/model/Role.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,33 @@ public Integer getRole() {
6666
public void setRole(Integer role) {
6767
this.role = role;
6868
}
69+
70+
@Override
71+
public int hashCode() {
72+
final int prime = 31;
73+
int result = 1;
74+
result = prime * result + ((role == null) ? 0 : role.hashCode());
75+
return result;
76+
}
77+
78+
@Override
79+
public boolean equals(final Object obj) {
80+
if (this == obj)
81+
return true;
82+
if (obj == null)
83+
return false;
84+
if (getClass() != obj.getClass())
85+
return false;
86+
final Role role = (Role) obj;
87+
if (!role.equals(role.role))
88+
return false;
89+
return true;
90+
}
91+
92+
@Override
93+
public String toString() {
94+
final StringBuilder builder = new StringBuilder();
95+
builder.append("Role [role=").append(role).append("]").append("[id=").append(id).append("]");
96+
return builder.toString();
97+
}
6998
}
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
################### DataSource Configuration ##########################
22
jdbc.driverClassName=com.mysql.jdbc.Driver
3-
jdbc.url=jdbc:mysql://localhost:3306/spring_hibernate4_02?createDatabaseIfNotExist=true
3+
jdbc.url=jdbc:mysql://localhost:3306/AUTHDATA
44
jdbc.user=tutorialuser
55
jdbc.pass=tutorialmy5ql
66
init-db=false
77
################### Hibernate Configuration ##########################
88
hibernate.dialect=org.hibernate.dialect.MySQLDialect
9-
hibernate.show_sql=false
10-
hibernate.hbm2ddl.auto=create-drop
11-
9+
hibernate.show_sql=true
10+
hibernate.hbm2ddl.auto=validate

spring-security-login-error-handling/src/main/webapp/WEB-INF/view/admin.jsp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
2-
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
2+
<%@ taglib prefix="sec"
3+
uri="http://www.springframework.org/security/tags"%>
34
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
45
<html>
5-
<sec:authorize ifAnyGranted="ROLE_USER">
6-
<spring:message code="message.unauth"></spring:message>
7-
</sec:authorize>
6+
87
<head>
98
<link href="<c:url value="/resources/bootstrap.css" />" rel="stylesheet">
109
</head>
11-
<<<<<<< HEAD
12-
=======
13-
14-
>>>>>>> FETCH_HEAD
1510
<body>
11+
<sec:authorize ifAnyGranted="ROLE_USER">
12+
<spring:message code="message.unauth"></spring:message>
13+
</sec:authorize>
1614
<sec:authorize ifAnyGranted="ROLE_ADMIN">
1715
<H1>Hello Admin</H1>
1816
</sec:authorize>

spring-security-login-error-handling/src/main/webapp/WEB-INF/view/console.jsp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
2-
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags"%>
2+
<%@ taglib prefix="sec"
3+
uri="http://www.springframework.org/security/tags"%>
34
<html>
4-
55
<head>
66
<link href="<c:url value="/resources/bootstrap.css" />" rel="stylesheet">
77
</head>
88
<body>
99
<h1>This is the landing page for the admin</h1>
10-
<security:authorize access="hasRole('ROLE_USER')">
10+
<sec:authorize access="hasRole('ROLE_USER')">
1111
This text is only visible to a user
1212
<br />
13-
</security:authorize>
14-
<security:authorize access="hasRole('ROLE_ADMIN')">
13+
</sec:authorize>
14+
<sec:authorize access="hasRole('ROLE_ADMIN')">
1515
This text is only visible to an admin
1616
<br />
17-
</security:authorize>
17+
</sec:authorize>
1818
<a href="<c:url value="/j_spring_security_logout" />">Logout</a>
1919
<a href="<c:url value="/admin.html" />">Administrator Page</a>
2020
</body>

spring-security-login-error-handling/src/main/webapp/WEB-INF/view/homepage.jsp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
2-
<<<<<<< HEAD
3-
<%@ taglib prefix="sec"
4-
uri="http://www.springframework.org/security/tags"%>
5-
=======
62
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
7-
>>>>>>> FETCH_HEAD
83
<%@ page session="true"%>
94
<html>
105
<head>
@@ -27,8 +22,4 @@
2722
<a href="<c:url value="/home.html" />">Home</a>
2823
<a href="<c:url value="/admin.html" />">Administrator Page</a>
2924
</body>
30-
<<<<<<< HEAD
31-
=======
32-
33-
>>>>>>> FETCH_HEAD
3425
</html>

spring-security-login-error-handling/src/main/webapp/WEB-INF/view/login.jsp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
55
<fmt:setBundle basename="messages" />
66
<%@ page session="true"%>
7-
87
<fmt:message key="message.password" var="noPass" />
98
<fmt:message key="message.username" var="noUser" />
109
<html>

spring-security-login-error-handling/src/main/webapp/WEB-INF/view/logout.jsp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
22
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
33
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
4-
54
<html>
65

76
<head>

0 commit comments

Comments
 (0)