comparison flys-client/src/main/java/de/intevation/flys/client/server/filter/GGInAFilter.java @ 4424:6ef48927df38

Remove authentication from MapPrintServiceImpl. Printing maps was broken because the called service required user authentication. The /flys/mapfish-print/print.pdf URI is now whitelisted in GGInAFilter. TODO: Support user authentication in MapPrintServiceImpl.
author Christian Lins <christian.lins@intevation.de>
date Tue, 06 Nov 2012 14:50:26 +0100
parents 687b7a6f09aa
children
comparison
equal deleted inserted replaced
4423:687b7a6f09aa 4424:6ef48927df38
1 package de.intevation.flys.client.server.filter; 1 package de.intevation.flys.client.server.filter;
2
3 import de.intevation.flys.client.server.auth.Authentication;
4 import de.intevation.flys.client.server.auth.AuthenticationException;
5 import de.intevation.flys.client.server.auth.AuthenticationFactory;
6 import de.intevation.flys.client.server.auth.User;
7 import de.intevation.flys.client.server.features.Features;
2 8
3 import java.io.IOException; 9 import java.io.IOException;
4 import java.util.Enumeration; 10 import java.util.Enumeration;
5 11
6 import javax.servlet.Filter; 12 import javax.servlet.Filter;
8 import javax.servlet.FilterConfig; 14 import javax.servlet.FilterConfig;
9 import javax.servlet.ServletContext; 15 import javax.servlet.ServletContext;
10 import javax.servlet.ServletException; 16 import javax.servlet.ServletException;
11 import javax.servlet.ServletRequest; 17 import javax.servlet.ServletRequest;
12 import javax.servlet.ServletResponse; 18 import javax.servlet.ServletResponse;
13
14 import javax.servlet.http.HttpServletRequest; 19 import javax.servlet.http.HttpServletRequest;
15 import javax.servlet.http.HttpServletResponse; 20 import javax.servlet.http.HttpServletResponse;
16 import javax.servlet.http.HttpSession; 21 import javax.servlet.http.HttpSession;
17 22
18 import org.apache.log4j.Logger; 23 import org.apache.log4j.Logger;
19
20 import de.intevation.flys.client.server.auth.Authentication;
21 import de.intevation.flys.client.server.auth.AuthenticationException;
22 import de.intevation.flys.client.server.auth.AuthenticationFactory;
23 import de.intevation.flys.client.server.auth.User;
24 import de.intevation.flys.client.server.features.Features;
25 24
26 25
27 /** ServletFilter used for GGInA authentification and certain authorisation. */ 26 /** ServletFilter used for GGInA authentification and certain authorisation. */
28 public class GGInAFilter implements Filter { 27 public class GGInAFilter implements Filter {
29 28
36 private ServletContext sc; 35 private ServletContext sc;
37 36
38 public static final String LOGIN_JSP = "/login.jsp"; 37 public static final String LOGIN_JSP = "/login.jsp";
39 public static final String LOGIN_SERVLET = "/flys/login"; 38 public static final String LOGIN_SERVLET = "/flys/login";
40 public static final String FLYS_CSS = "/FLYS.css"; 39 public static final String FLYS_CSS = "/FLYS.css";
40 public static final String MAP_PRINT = "/flys/map-print";
41 public static final String MAPFISH_PRINT = "/flys/mapfish-print/print.pdf";
41 42
42 43
43 /** 44 /**
44 * Initialize. 45 * Initialize.
45 * 46 *
87 logger.debug("Request for: " + requesturi); 88 logger.debug("Request for: " + requesturi);
88 89
89 // Allow access to login pages 90 // Allow access to login pages
90 // TODO Maybe replace with Filter <url-pattern> 91 // TODO Maybe replace with Filter <url-pattern>
91 String path = this.sc.getContextPath(); 92 String path = this.sc.getContextPath();
92 if (requesturi.equals(path + "/login.jsp") || 93 if (requesturi.equals(path + LOGIN_JSP)
93 requesturi.equals(path + "/flys/login") 94 || requesturi.equals(path + LOGIN_SERVLET)
94 || requesturi.equals(path + "/FLYS.css")) { 95 || requesturi.equals(path + FLYS_CSS)
96 || requesturi.equals(path + MAP_PRINT)
97 || requesturi.equals(path + MAPFISH_PRINT)) {
95 logger.debug("Request for login " + requesturi); 98 logger.debug("Request for login " + requesturi);
96 chain.doFilter(req, resp); 99 chain.doFilter(req, resp);
97 return; 100 return;
98 } 101 }
99 102

http://dive4elements.wald.intevation.org