Last change
on this file since 950fa0d was 8bcd64c, checked in by Gjoko Kostadinov <gjoko.kostadinov@…>, 15 months ago |
Add admin functionality and business admin functionality.
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[8bcd64c] | 1 | package edu.gjoko.schedlr.config;
|
---|
| 2 |
|
---|
| 3 | import org.apache.commons.logging.Log;
|
---|
| 4 | import org.apache.commons.logging.LogFactory;
|
---|
| 5 | import org.springframework.security.authentication.BadCredentialsException;
|
---|
| 6 | import org.springframework.security.authentication.InternalAuthenticationServiceException;
|
---|
| 7 | import org.springframework.security.core.AuthenticationException;
|
---|
| 8 | import org.springframework.security.web.authentication.AuthenticationFailureHandler;
|
---|
| 9 |
|
---|
| 10 | import javax.servlet.ServletException;
|
---|
| 11 | import javax.servlet.http.HttpServletRequest;
|
---|
| 12 | import javax.servlet.http.HttpServletResponse;
|
---|
| 13 | import java.io.IOException;
|
---|
| 14 |
|
---|
| 15 | public class AppAuthenticationFailureHandler implements AuthenticationFailureHandler {
|
---|
| 16 |
|
---|
| 17 | protected Log logger = LogFactory.getLog(this.getClass());
|
---|
| 18 | @Override
|
---|
| 19 | public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException {
|
---|
| 20 | if (exception instanceof InternalAuthenticationServiceException) {
|
---|
| 21 | response.sendRedirect(request.getContextPath() + "/login?error=notApproved");
|
---|
| 22 | } else if (exception instanceof BadCredentialsException) {
|
---|
| 23 | response.sendRedirect(request.getContextPath() + "/login?error=badCredentials");
|
---|
| 24 | }
|
---|
| 25 | }
|
---|
| 26 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.