Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/server/LoginServlet.java @ 3697:2e12518ff5b4
Removed trailing whitespace. Reverted functional change in parsing plain user file.
flys-client/trunk@5396 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sat, 08 Sep 2012 12:22:53 +0000 |
parents | a050cb5f303f |
children | a4c9296f6efa |
comparison
equal
deleted
inserted
replaced
3696:a050cb5f303f | 3697:2e12518ff5b4 |
---|---|
47 this.redirectFailure(resp); | 47 this.redirectFailure(resp); |
48 } | 48 } |
49 | 49 |
50 @Override | 50 @Override |
51 protected void doPost(HttpServletRequest req, HttpServletResponse resp) | 51 protected void doPost(HttpServletRequest req, HttpServletResponse resp) |
52 throws ServletException, IOException | 52 throws ServletException, IOException |
53 { | 53 { |
54 String encoding = req.getCharacterEncoding(); | 54 String encoding = req.getCharacterEncoding(); |
55 String username = req.getParameter("username"); | 55 String username = req.getParameter("username"); |
56 String password = req.getParameter("password"); | 56 String password = req.getParameter("password"); |
57 | 57 |
60 if (username == null || password == null) { | 60 if (username == null || password == null) { |
61 logger.debug("No username or password provided"); | 61 logger.debug("No username or password provided"); |
62 this.redirectFailure(resp); | 62 this.redirectFailure(resp); |
63 return; | 63 return; |
64 } | 64 } |
65 | 65 |
66 try { | 66 try { |
67 Authentication aresp = this.auth(username, password, encoding); | 67 Authentication aresp = this.auth(username, password, encoding); |
68 if (aresp == null || !aresp.isSuccess()) { | 68 if (aresp == null || !aresp.isSuccess()) { |
69 logger.debug("Authentication not successful"); | 69 logger.debug("Authentication not successful"); |
70 this.redirectFailure(resp); | 70 this.redirectFailure(resp); |
92 this.redirectFailure(resp, e); | 92 this.redirectFailure(resp, e); |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 private Authentication auth(String username, String password, String encoding) | 96 private Authentication auth(String username, String password, String encoding) |
97 throws AuthenticationException, IOException | 97 throws AuthenticationException, IOException |
98 { | 98 { |
99 ServletContext sc = this.getServletContext(); | 99 ServletContext sc = this.getServletContext(); |
100 Features features = (Features)sc.getAttribute(Features.CONTEXT_ATTRIBUTE); | 100 Features features = (Features)sc.getAttribute(Features.CONTEXT_ATTRIBUTE); |
101 String auth = sc.getInitParameter("authentication"); | 101 String auth = sc.getInitParameter("authentication"); |
102 return AuthenticationFactory.getInstance(auth).auth(username, password, encoding, features); | 102 return AuthenticationFactory.getInstance(auth).auth(username, password, encoding, features); |