improvements, additional security dialect

This commit is contained in:
kwandzel 2018-02-17 16:59:50 +01:00
parent 6642fc53a4
commit 77735a57fd
4 changed files with 11 additions and 9 deletions

View File

@ -30,8 +30,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
auth.inMemoryAuthentication()
.withUser("user").password("password").roles("USER").and()
.withUser("admin").password("admin").roles("ADMIN");
}

View File

@ -11,7 +11,7 @@ public class ViewController {
return "login";
}
@RequestMapping({"/index", "/"})
@RequestMapping({ "/index", "/" })
public String index() {
return "index";
}

View File

@ -8,5 +8,8 @@
<p>Spring Security Thymeleaf tutorial</p>
<div sec:authorize="hasRole('USER')">Text visible to user.</div>
<div sec:authorize="hasRole('ADMIN')">Text visible to admin.</div>
<div sec:authorize="isAuthenticated()">Text visible only to authenticated users.</div>
Authenticated username: <div sec:authentication="name"></div>
Authenticated user roles: <div sec:authentication="principal.authorities"></div>
</body>
</html>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Insert title here</title>
<title>Custom Login Page</title>
</head>
<body>
<h2>Custom Login Page</h2>