Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/server/auth/was/Response.java @ 2968:3e0567e02577
Extend Authentication and Response to throw additional exceptions
flys-client/trunk@4964 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Bjoern Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Fri, 13 Jul 2012 06:46:27 +0000 |
parents | 5ba0a6efdf3b |
children | 98514ab2c9ba |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/auth/was/Response.java Fri Jul 13 06:33:48 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/auth/was/Response.java Fri Jul 13 06:46:27 2012 +0000 @@ -15,6 +15,7 @@ import org.jdom.input.SAXBuilder; import de.intevation.flys.client.server.auth.Authentication; +import de.intevation.flys.client.server.auth.AuthenticationException; public class Response implements Authentication { @@ -26,7 +27,7 @@ private String password; - public Response(HttpEntity entity, String username, String password) throws ServiceException { + public Response(HttpEntity entity, String username, String password) throws AuthenticationException, IOException { if (entity == null) { throw new ServiceException("Invalid response"); @@ -57,10 +58,7 @@ } catch(JDOMException e) { - logger.error(e); - } - catch(IOException e) { - logger.error(e); + throw new AuthenticationException(e); } } @@ -99,8 +97,12 @@ } @Override - public User getUser() { - return new User(this.username, this.password); + public User getUser() throws AuthenticationException { + Assertion assertion = this.getAssertion(); + if (assertion == null) { + throw new AuthenticationException("Response doesn't contain an assertion"); + } + return new User(this.username, this.password, assertion); } } // vim: set si et fileencoding=utf-8 ts=4 sw=4 tw=80: