diff flys-client/src/main/java/de/intevation/flys/client/server/auth/was/Response.java @ 3486:23095983c249

Implement Features handling for WAS authentication flys-client/trunk@5184 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Ricks <bjoern.ricks@intevation.de>
date Fri, 10 Aug 2012 08:17:52 +0000
parents d700f6492386
children 6f36f79676a7
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/auth/was/Response.java	Fri Aug 10 07:06:18 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/auth/was/Response.java	Fri Aug 10 08:17:52 2012 +0000
@@ -2,6 +2,7 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.List;
 
 import org.apache.commons.codec.binary.Base64InputStream;
 
@@ -17,6 +18,8 @@
 import de.intevation.flys.client.server.auth.Authentication;
 import de.intevation.flys.client.server.auth.AuthenticationException;
 
+import de.intevation.flys.client.server.features.Features;
+
 public class Response implements Authentication {
 
     private static Logger logger = Logger.getLogger(Response.class);
@@ -25,9 +28,10 @@
     private Assertion assertion;
     private String username;
     private String password;
+    private Features features;
 
 
-    public Response(HttpEntity entity, String username, String password) throws AuthenticationException, IOException {
+    public Response(HttpEntity entity, String username, String password, Features features) throws AuthenticationException, IOException {
 
         if (entity == null) {
             throw new ServiceException("Invalid response");
@@ -55,6 +59,7 @@
             this.root = root;
             this.username = username;
             this.password = password;
+            this.features = features;
 
         }
         catch(JDOMException e) {
@@ -102,7 +107,10 @@
         if (assertion == null) {
             throw new AuthenticationException("Response doesn't contain an assertion");
         }
-        return new User(this.username, this.password, this.assertion.getRoles(), assertion);
+        List<String> features = this.features.getFeatures(
+                this.assertion.getRoles());
+        return new User(this.username, this.password,
+                this.assertion.getRoles(), assertion, features);
     }
 }
 // vim: set si et fileencoding=utf-8 ts=4 sw=4 tw=80:

http://dive4elements.wald.intevation.org