improvements, additional security dialect
This commit is contained in:
parent
6642fc53a4
commit
77735a57fd
|
@ -30,9 +30,8 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
|||
|
||||
@Autowired
|
||||
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth
|
||||
.inMemoryAuthentication()
|
||||
.withUser("user").password("password").roles("USER").and()
|
||||
.withUser("admin").password("admin").roles("ADMIN");
|
||||
auth.inMemoryAuthentication()
|
||||
.withUser("user").password("password").roles("USER").and()
|
||||
.withUser("admin").password("admin").roles("ADMIN");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,17 +5,17 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
|
||||
@Controller
|
||||
public class ViewController {
|
||||
|
||||
|
||||
@RequestMapping("/login")
|
||||
public String login() {
|
||||
return "login";
|
||||
}
|
||||
|
||||
@RequestMapping({"/index", "/"})
|
||||
|
||||
@RequestMapping({ "/index", "/" })
|
||||
public String index() {
|
||||
return "index";
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/loginError")
|
||||
public String loginError() {
|
||||
return "loginError";
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue