Skip to content

Commit

Permalink
Modified code to reflect the code from the article
Browse files Browse the repository at this point in the history
  • Loading branch information
zhendrikse committed Dec 20, 2016
1 parent de2080f commit 66e6ae6
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class RegistrationController {
private static final Logger logger = LoggerFactory.getLogger(RegistrationController.class);

@Autowired
AuthenticationManager authenticationManager;
private AuthenticationManager authenticationManager;

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

String view = "registrationSuccess";

if (requestQualifiesForManualAuthentication()) {
try {
authenticate(username, password, request, response);
logger.debug("registerAndAuthenticate: authentication completed.");
} catch (BadCredentialsException bce) {
logger.debug("Authentication failure: bad credentials");
bce.printStackTrace();
view = "systemError"; // assume a low-level error, since the registration
return "systemError"; // assume a low-level error, since the registration
// form would have been successfully validated
}
}

return view;
return "registrationSuccess";
}

private boolean requestQualifiesForManualAuthentication() {
Expand Down

0 comments on commit 66e6ae6

Please sign in to comment.