Mercurial > dive4elements > river
comparison 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 |
comparison
equal
deleted
inserted
replaced
3484:83845aa322ea | 3485:71ba3cf3ec5e |
---|---|
1 package de.intevation.flys.client.server; | 1 package de.intevation.flys.client.server; |
2 | 2 |
3 import java.io.IOException; | 3 import java.io.IOException; |
4 | 4 |
5 import javax.servlet.ServletException; | 5 import javax.servlet.ServletException; |
6 import javax.servlet.ServletContext; | |
6 import javax.servlet.http.HttpServlet; | 7 import javax.servlet.http.HttpServlet; |
7 import javax.servlet.http.HttpServletRequest; | 8 import javax.servlet.http.HttpServletRequest; |
8 import javax.servlet.http.HttpServletResponse; | 9 import javax.servlet.http.HttpServletResponse; |
9 import javax.servlet.http.HttpSession; | 10 import javax.servlet.http.HttpSession; |
10 | 11 |
13 import de.intevation.flys.client.server.auth.Authentication; | 14 import de.intevation.flys.client.server.auth.Authentication; |
14 import de.intevation.flys.client.server.auth.AuthenticationException; | 15 import de.intevation.flys.client.server.auth.AuthenticationException; |
15 import de.intevation.flys.client.server.auth.AuthenticationFactory; | 16 import de.intevation.flys.client.server.auth.AuthenticationFactory; |
16 import de.intevation.flys.client.server.auth.User; | 17 import de.intevation.flys.client.server.auth.User; |
17 import de.intevation.flys.client.server.auth.UserClient; | 18 import de.intevation.flys.client.server.auth.UserClient; |
19 import de.intevation.flys.client.server.features.Features; | |
18 | 20 |
19 public class LoginServlet extends HttpServlet { | 21 public class LoginServlet extends HttpServlet { |
20 | 22 |
21 private static Logger logger = Logger.getLogger(LoginServlet.class); | 23 private static Logger logger = Logger.getLogger(LoginServlet.class); |
22 | 24 |
87 } | 89 } |
88 } | 90 } |
89 | 91 |
90 private Authentication auth(String username, String password, String encoding) | 92 private Authentication auth(String username, String password, String encoding) |
91 throws AuthenticationException, IOException { | 93 throws AuthenticationException, IOException { |
92 String auth = this.getServletContext().getInitParameter("authentication"); | 94 ServletContext sc = this.getServletContext(); |
93 return AuthenticationFactory.getInstance(auth).auth(username, password, encoding); | 95 Features features = (Features)sc.getAttribute(Features.CONTEXT_ATTRIBUTE); |
96 String auth = sc.getInitParameter("authentication"); | |
97 return AuthenticationFactory.getInstance(auth).auth(username, password, encoding, features); | |
94 } | 98 } |
95 } | 99 } |