changeset 2972:6266dff93ed2

Use servlet context to specify the authentication method. Using the servlet context allows to set the method globally and not only for one servlet. flys-client/trunk@4968 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Ricks <bjoern.ricks@intevation.de>
date Fri, 13 Jul 2012 07:50:22 +0000
parents 229c34d6e87b
children b732258fd546
files flys-client/src/main/java/de/intevation/flys/client/server/LoginServlet.java flys-client/src/main/webapp/WEB-INF/web.xml
diffstat 2 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/LoginServlet.java	Fri Jul 13 07:12:06 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/LoginServlet.java	Fri Jul 13 07:50:22 2012 +0000
@@ -76,7 +76,7 @@
 
     private Authentication auth(String username, String password, String encoding)
         throws AuthenticationException, IOException {
-        String auth = this.getInitParameter("authentication");
+        String auth = this.getServletContext().getInitParameter("authentication");
         return AuthenticationFactory.getInstance(auth).auth(username, password, encoding);
     }
 }
--- a/flys-client/src/main/webapp/WEB-INF/web.xml	Fri Jul 13 07:12:06 2012 +0000
+++ b/flys-client/src/main/webapp/WEB-INF/web.xml	Fri Jul 13 07:50:22 2012 +0000
@@ -8,6 +8,8 @@
     <context-param>
         <param-name>server-url</param-name>
         <param-value>http://localhost:8181</param-value>
+        <param-name>authentication</param-name>
+        <param-value>GGInA</param-value>
     </context-param>
   
   <!-- Servlets -->
@@ -481,10 +483,6 @@
   <servlet>
     <servlet-name>login</servlet-name>
     <servlet-class>de.intevation.flys.client.server.LoginServlet</servlet-class>
-    <init-param>
-        <param-name>authentication</param-name>
-        <param-value>GGInA</param-value>
-    </init-param>
   </servlet>
 
   <servlet-mapping>

http://dive4elements.wald.intevation.org