Skip to content

Commit 66e6ae6

Browse files
committed
Modified code to reflect the code from the article
1 parent de2080f commit 66e6ae6

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class RegistrationController {
3030
private static final Logger logger = LoggerFactory.getLogger(RegistrationController.class);
3131

3232
@Autowired
33-
AuthenticationManager authenticationManager;
33+
private AuthenticationManager authenticationManager;
3434

3535
/**
3636
* For demo purposes this need only be a GET request method
@@ -49,21 +49,19 @@ public String registerAndAuthenticate(HttpServletRequest request, HttpServletRes
4949
String username = "user";
5050
String password = "password";
5151

52-
String view = "registrationSuccess";
53-
5452
if (requestQualifiesForManualAuthentication()) {
5553
try {
5654
authenticate(username, password, request, response);
5755
logger.debug("registerAndAuthenticate: authentication completed.");
5856
} catch (BadCredentialsException bce) {
5957
logger.debug("Authentication failure: bad credentials");
6058
bce.printStackTrace();
61-
view = "systemError"; // assume a low-level error, since the registration
59+
return "systemError"; // assume a low-level error, since the registration
6260
// form would have been successfully validated
6361
}
6462
}
6563

66-
return view;
64+
return "registrationSuccess";
6765
}
6866

6967
private boolean requestQualifiesForManualAuthentication() {

0 commit comments

Comments
 (0)