changeset 3504:1387cdeb8d93

Add account information to flys-client user classes flys-client/trunk@5256 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Ricks <bjoern.ricks@intevation.de>
date Fri, 24 Aug 2012 10:49:23 +0000
parents 56f17c6c6288
children 637d114232b2
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/server/auth/DefaultUser.java flys-client/src/main/java/de/intevation/flys/client/server/auth/User.java flys-client/src/main/java/de/intevation/flys/client/server/auth/was/Response.java flys-client/src/main/java/de/intevation/flys/client/server/auth/was/User.java
diffstat 5 files changed, 29 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Fri Aug 24 10:44:55 2012 +0000
+++ b/flys-client/ChangeLog	Fri Aug 24 10:49:23 2012 +0000
@@ -1,3 +1,13 @@
+2012-08-24	Björn Ricks <bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/auth/DefaultUser.java,
+	  src/main/java/de/intevation/flys/client/server/auth/was/Response.java,
+	  src/main/java/de/intevation/flys/client/server/auth/was/User.java,
+	  src/main/java/de/intevation/flys/client/server/auth/User.java:
+	  Add account information to client user classes. Use the WAS/GGInA
+	  assertion NameIdentifier element for the account name. For text
+	  authentication user username also as account name.
+
 2012-08-24	Björn Ricks <bjoern.ricks@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/server/LoginServlet.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/server/auth/DefaultUser.java	Fri Aug 24 10:44:55 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/auth/DefaultUser.java	Fri Aug 24 10:49:23 2012 +0000
@@ -6,6 +6,7 @@
 implements   User
 {
     protected String  name;
+    protected String  account;
     protected String  password;
     protected boolean expired;
     protected List<String> roles;
@@ -26,6 +27,7 @@
         this.expired  = expired;
         this.roles    = roles;
         this.features = features;
+        this.account  = name;
     }
 
     @Override
@@ -73,5 +75,14 @@
     public void setAllowedFeatures(List<String> features) {
         this.features = features;
     }
+
+    @Override
+    public String getAccount() {
+        return this.account;
+    }
+
+    public void setAccount(String account) {
+        this.account = account;
+    }
 }
 // vim:set ts=4 sw=4 si et fenc=utf8 tw=80:
--- a/flys-client/src/main/java/de/intevation/flys/client/server/auth/User.java	Fri Aug 24 10:44:55 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/auth/User.java	Fri Aug 24 10:49:23 2012 +0000
@@ -33,5 +33,10 @@
      * Returns true if the user is allowed access the feature
      */
     public boolean canUseFeature(String feature);
+
+    /**
+     * Returns the users account name
+     */
+    public String getAccount();
 }
 // vim:set ts=4 sw=4 si et fenc=utf8 tw=80:
--- a/flys-client/src/main/java/de/intevation/flys/client/server/auth/was/Response.java	Fri Aug 24 10:44:55 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/auth/was/Response.java	Fri Aug 24 10:49:23 2012 +0000
@@ -111,7 +111,7 @@
                 this.assertion.getRoles());
         logger.debug("User " + this.username + " with features " + features +
                      " successfully authenticated.");
-        return new User(this.username, this.password,
+        return new User(this.username, this.password, assertion.getNameID(),
                 this.assertion.getRoles(), assertion, features);
     }
 }
--- a/flys-client/src/main/java/de/intevation/flys/client/server/auth/was/User.java	Fri Aug 24 10:44:55 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/auth/was/User.java	Fri Aug 24 10:49:23 2012 +0000
@@ -13,6 +13,7 @@
 
     public User(String name,
         String       password,
+        String       account,
         List<String> roles,
         Assertion    assertion,
         List<String> features
@@ -22,6 +23,7 @@
         this.setRoles(roles);
         this.assertion = assertion;
         this.setAllowedFeatures(features);
+        this.setAccount(account);
     }
 
     @Override

http://dive4elements.wald.intevation.org