Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/server/auth/saml/User.java @ 5948:d7b9b3e3c61a
Make instantiation of saml.User easier.
Most of the parameters of the constructor can be taken from the
Assertion object, so there's no reason to pass them separately.
Also, trying to check the validity dates isn't useful for the single
sign on case. See comments in the hasExpired method.
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Wed, 08 May 2013 17:56:14 +0200 |
parents | 0b092a1d136b |
children | a51adfc957bf |
rev | line source |
---|---|
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5947
0b092a1d136b
Move User class from was to saml sub-package.
Bernhard Herzog <bh@intevation.de>
parents:
5944
diff
changeset
|
9 package org.dive4elements.river.client.server.auth.saml; |
2956
d7f76f197d89
Refactor GGInA authentication
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
10 |
2966
d115f719f0c0
Derive was User class from new DefaultUser class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
11 import java.util.Date; |
2978
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2966
diff
changeset
|
12 import java.util.List; |
2956
d7f76f197d89
Refactor GGInA authentication
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
13 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
14 import org.dive4elements.river.client.server.auth.DefaultUser; |
5944
d6f13dba21fe
Adapt WAS Response to new SAML validation code.
Bernhard Herzog <bh@intevation.de>
parents:
5861
diff
changeset
|
15 import org.dive4elements.river.client.server.auth.saml.Assertion; |
2956
d7f76f197d89
Refactor GGInA authentication
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
16 |
2966
d115f719f0c0
Derive was User class from new DefaultUser class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
17 public class User |
d115f719f0c0
Derive was User class from new DefaultUser class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
18 extends DefaultUser |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
19 implements org.dive4elements.river.client.server.auth.User { |
2966
d115f719f0c0
Derive was User class from new DefaultUser class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
20 |
d115f719f0c0
Derive was User class from new DefaultUser class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
21 private Assertion assertion; |
d115f719f0c0
Derive was User class from new DefaultUser class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
22 |
5948
d7b9b3e3c61a
Make instantiation of saml.User easier.
Bernhard Herzog <bh@intevation.de>
parents:
5947
diff
changeset
|
23 public User(Assertion assertion, List<String> features, String password) { |
d7b9b3e3c61a
Make instantiation of saml.User easier.
Bernhard Herzog <bh@intevation.de>
parents:
5947
diff
changeset
|
24 this.setName(assertion.getUserID()); |
d7b9b3e3c61a
Make instantiation of saml.User easier.
Bernhard Herzog <bh@intevation.de>
parents:
5947
diff
changeset
|
25 this.setAccount(assertion.getNameID()); |
d7b9b3e3c61a
Make instantiation of saml.User easier.
Bernhard Herzog <bh@intevation.de>
parents:
5947
diff
changeset
|
26 this.setRoles(assertion.getRoles()); |
2966
d115f719f0c0
Derive was User class from new DefaultUser class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
27 this.assertion = assertion; |
3486
23095983c249
Implement Features handling for WAS authentication
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2978
diff
changeset
|
28 this.setAllowedFeatures(features); |
5948
d7b9b3e3c61a
Make instantiation of saml.User easier.
Bernhard Herzog <bh@intevation.de>
parents:
5947
diff
changeset
|
29 this.setPassword(password); |
2956
d7f76f197d89
Refactor GGInA authentication
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
30 } |
d7f76f197d89
Refactor GGInA authentication
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
31 |
2966
d115f719f0c0
Derive was User class from new DefaultUser class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
32 @Override |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2956
diff
changeset
|
33 public boolean hasExpired() { |
5948
d7b9b3e3c61a
Make instantiation of saml.User easier.
Bernhard Herzog <bh@intevation.de>
parents:
5947
diff
changeset
|
34 // We could check the validity dates of the assertion here, but |
d7b9b3e3c61a
Make instantiation of saml.User easier.
Bernhard Herzog <bh@intevation.de>
parents:
5947
diff
changeset
|
35 // when using this for Single-Sign-On this would lead to the |
d7b9b3e3c61a
Make instantiation of saml.User easier.
Bernhard Herzog <bh@intevation.de>
parents:
5947
diff
changeset
|
36 // code in GGInAFilter to re-authenticate with the password |
d7b9b3e3c61a
Make instantiation of saml.User easier.
Bernhard Herzog <bh@intevation.de>
parents:
5947
diff
changeset
|
37 // stored in the User object, which isn't known in the case of |
d7b9b3e3c61a
Make instantiation of saml.User easier.
Bernhard Herzog <bh@intevation.de>
parents:
5947
diff
changeset
|
38 // Single-Sign-On. |
2956
d7f76f197d89
Refactor GGInA authentication
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
39 return false; |
d7f76f197d89
Refactor GGInA authentication
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
40 } |
d7f76f197d89
Refactor GGInA authentication
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
41 } |
d7f76f197d89
Refactor GGInA authentication
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
42 |
d7f76f197d89
Refactor GGInA authentication
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
43 // vim:set ts=4 sw=4 si et fenc=utf8 tw=80: |