Added comments to web security confit, added registration pages to whitelist.
This commit is contained in:
parent
153df56a89
commit
2805bb061e
|
@ -10,6 +10,15 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
|
|||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
|
||||
/**
|
||||
* Security configuration for the TAA application.
|
||||
*
|
||||
* This configuration makes use of the custom user details service provided by the application for database-persistent
|
||||
* user accounts.
|
||||
*
|
||||
* Login, logout, and registration pages are set so that all users, authenticated and unauthenticated, may access them,
|
||||
* while actual site content is only visible to authenticated users.
|
||||
*/
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
@ -31,8 +40,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
http
|
||||
.csrf().disable() // So that we can GET the logout page.
|
||||
|
||||
.authorizeRequests() // Let anyone view the login and logout pages.
|
||||
.antMatchers("/login*", "/logout*", "/register*")
|
||||
.authorizeRequests() // Let anyone view the login and logout pages, as well as various registration pages.
|
||||
.antMatchers("/login*", "/logout*", "/register*", "/register/**")
|
||||
.permitAll()
|
||||
.and()
|
||||
|
||||
|
|
|
@ -15,8 +15,6 @@ public class LoginController {
|
|||
|
||||
@GetMapping("/login")
|
||||
public String get() {
|
||||
logger.info("User got login page.");
|
||||
|
||||
return "login";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package nl.andrewlalis.teaching_assistant_assistant.controllers.register;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
/**
|
||||
* Controller for the registration form for new students.
|
||||
*/
|
||||
@Controller
|
||||
public class StudentRegisterController {
|
||||
|
||||
@GetMapping("/register/student")
|
||||
public String get() {
|
||||
|
||||
|
||||
return "/register/student";
|
||||
}
|
||||
|
||||
}
|
|
@ -1,10 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<html xmlns:th="http://www.thymeleaf.org" th:replace="~{layouts/basic_page :: layout (title='Register as a New Student', content=~{::#content})}" lang="en">
|
||||
<body>
|
||||
|
||||
<section id="content" class="container">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p>
|
||||
Here you can register to create a new account to access the information provided by this application, whether you are a professor, teaching assistant, or student. After filling out this submission form, you'll receive an email with a link to verify that you are who you say you are, after which your account will be activated.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row justify-content-center">
|
||||
<h3>I am a ...</h3>
|
||||
</div>
|
||||
|
||||
<div class="row justify-content-center">
|
||||
<div class="col text-center">
|
||||
<a class="btn btn-primary" th:href="@{/register/student}">Student</a>
|
||||
</div>
|
||||
<div class="col text-center">
|
||||
<a class="btn btn-primary" th:href="@{/register/teaching_assistant}">Teaching Assistant</a>
|
||||
</div>
|
||||
<div class="col text-center">
|
||||
<a class="btn btn-primary" th:href="@{/register/administrator}">Administrator</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue