Commit 47a2e1f0 authored by Gradl, Tobias's avatar Gradl, Tobias
Browse files

734: Failed local logins lead to 401 instead of reshowing login dialog

Task-Url: https://minfba.de.dariah.eu/mantisbt/view.php?id=734
parent 10ec4787
......@@ -25,7 +25,7 @@ import eu.dariah.de.dariahsp.exceptions.UserCredentialsException;
@RequestMapping(value="/errors")
public class SampleExceptionController {
protected static final Logger logger = LoggerFactory.getLogger(SampleExceptionController.class);
@RequestMapping(value = {"", "/"}, method = {RequestMethod.GET, RequestMethod.POST })
public String renderErrorPage(Model m, HttpServletRequest httpRequest) {
String errorHeading = "";
......@@ -90,6 +90,11 @@ public class SampleExceptionController {
return "error";
}
@RequestMapping(value = "/loginFailed", method = {RequestMethod.GET, RequestMethod.POST })
public String handleLoginFailed(Model m, HttpServletRequest httpRequest) {
return "redirect:/login?error=true";
}
private Exception getException(HttpServletRequest httpRequest) {
if (httpRequest.getAttribute("javax.servlet.error.exception")==null) {
......
......@@ -59,7 +59,11 @@
<property name="filterProcessesUrl" value="/localsec/login" />
<property name="authenticationSuccessHandler" ref="successRedirectHandler" />
<property name="authenticationFailureHandler" ref="authenticationFailureHandler"/>
</bean>
<bean id="authenticationFailureHandler" class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler">
<property name="defaultFailureUrl" value="/errors/loginFailed" />
</bean>
<bean id="logoutHandler" class="org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment