Skip to content

Commit ada5fca

Browse files
committed
Refactor RegistrationController
1 parent 056bbc0 commit ada5fca

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

‎spring-security-client/spring-security-thymeleaf-authentication/src/main/java/org/baeldung/config/RegistrationController.java‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package org.baeldung.config;
22

3-
import javax.servlet.http.HttpServletRequest;
4-
import javax.servlet.http.HttpServletResponse;
5-
63
import org.slf4j.Logger;
74
import org.slf4j.LoggerFactory;
85
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.context.annotation.Profile;
97
import org.springframework.security.authentication.AbstractAuthenticationToken;
108
import org.springframework.security.authentication.AuthenticationManager;
119
import org.springframework.security.authentication.BadCredentialsException;
@@ -14,9 +12,10 @@
1412
import org.springframework.security.core.context.SecurityContextHolder;
1513
import org.springframework.security.web.authentication.WebAuthenticationDetails;
1614
import org.springframework.stereotype.Controller;
17-
import org.springframework.web.bind.annotation.RequestMapping;
18-
import org.springframework.web.bind.annotation.RequestMethod;
19-
import org.springframework.context.annotation.Profile;
15+
import org.springframework.web.bind.annotation.GetMapping;
16+
17+
import javax.servlet.http.HttpServletRequest;
18+
import javax.servlet.http.HttpServletResponse;
2019

2120
/**
2221
* Manually authenticate a user using Spring Security / Spring Web MVC' (upon successful account registration)
@@ -40,7 +39,7 @@ public class RegistrationController {
4039
* @return The view. Page confirming either successful registration (and/or
4140
* successful authentication) or failed registration.
4241
*/
43-
@RequestMapping(value = "/register", method = RequestMethod.GET)
42+
@GetMapping("/register")
4443
public String registerAndAuthenticate(HttpServletRequest request, HttpServletResponse response) {
4544
logger.debug("registerAndAuthenticate: attempt to register, application should manually authenticate.");
4645

0 commit comments

Comments
 (0)