diff flys-client/src/main/java/de/intevation/flys/client/server/LoginServlet.java @ 3485:71ba3cf3ec5e

Refactor Authentication to allow to pass the Freatures to the user class The Features class can be used to receive the allowed features for the users roles. flys-client/trunk@5183 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Ricks <bjoern.ricks@intevation.de>
date Fri, 10 Aug 2012 07:06:18 +0000
parents 06d999e95615
children 56f17c6c6288
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/LoginServlet.java	Thu Aug 09 08:22:04 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/LoginServlet.java	Fri Aug 10 07:06:18 2012 +0000
@@ -3,6 +3,7 @@
 import java.io.IOException;
 
 import javax.servlet.ServletException;
+import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -15,6 +16,7 @@
 import de.intevation.flys.client.server.auth.AuthenticationFactory;
 import de.intevation.flys.client.server.auth.User;
 import de.intevation.flys.client.server.auth.UserClient;
+import de.intevation.flys.client.server.features.Features;
 
 public class LoginServlet extends HttpServlet {
 
@@ -89,7 +91,9 @@
 
     private Authentication auth(String username, String password, String encoding)
         throws AuthenticationException, IOException {
-        String auth = this.getServletContext().getInitParameter("authentication");
-        return AuthenticationFactory.getInstance(auth).auth(username, password, encoding);
+        ServletContext sc = this.getServletContext();
+        Features features = (Features)sc.getAttribute(Features.CONTEXT_ATTRIBUTE);
+        String auth = sc.getInitParameter("authentication");
+        return AuthenticationFactory.getInstance(auth).auth(username, password, encoding, features);
     }
 }

http://dive4elements.wald.intevation.org