comparison flys-client/src/main/java/de/intevation/flys/client/server/LoginServlet.java @ 2969:16c71457ed43

Display error details to the user If an authentication fails the user should be informed about the reason. flys-client/trunk@4965 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Ricks <bjoern.ricks@intevation.de>
date Fri, 13 Jul 2012 06:52:33 +0000
parents d7f76f197d89
children b89dd09b486c
comparison
equal deleted inserted replaced
2968:3e0567e02577 2969:16c71457ed43
19 19
20 private static Logger logger = Logger.getLogger(LoginServlet.class); 20 private static Logger logger = Logger.getLogger(LoginServlet.class);
21 21
22 private void redirectFailure(HttpServletResponse resp) throws IOException { 22 private void redirectFailure(HttpServletResponse resp) throws IOException {
23 resp.sendRedirect("/login.jsp"); 23 resp.sendRedirect("/login.jsp");
24 }
25
26 private void redirectFailure(HttpServletResponse resp, Exception e) throws IOException {
27 resp.sendRedirect("/login.jsp?error=" + e.getMessage());
24 } 28 }
25 29
26 private void redirectSuccess(HttpServletResponse resp, String uri) throws IOException { 30 private void redirectSuccess(HttpServletResponse resp, String uri) throws IOException {
27 if (uri == null) { 31 if (uri == null) {
28 uri = "/FLYS.html"; 32 uri = "/FLYS.html";
63 String uri = (String)session.getAttribute("requesturi"); 67 String uri = (String)session.getAttribute("requesturi");
64 68
65 this.redirectSuccess(resp, uri); 69 this.redirectSuccess(resp, uri);
66 } 70 }
67 catch(AuthenticationException e) { 71 catch(AuthenticationException e) {
68 //TODO User could not be authenticated 72 this.redirectFailure(resp, e);
69 throw new ServletException(e);
70 } 73 }
71 } 74 }
72 75
73 private Authentication auth(String username, String password, String encoding) 76 private Authentication auth(String username, String password, String encoding)
74 throws AuthenticationException, IOException { 77 throws AuthenticationException, IOException {

http://dive4elements.wald.intevation.org