Mercurial > dive4elements > river
comparison 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 |
comparison
equal
deleted
inserted
replaced
5947:0b092a1d136b | 5948:d7b9b3e3c61a |
---|---|
18 extends DefaultUser | 18 extends DefaultUser |
19 implements org.dive4elements.river.client.server.auth.User { | 19 implements org.dive4elements.river.client.server.auth.User { |
20 | 20 |
21 private Assertion assertion; | 21 private Assertion assertion; |
22 | 22 |
23 public User(String name, | 23 public User(Assertion assertion, List<String> features, String password) { |
24 String password, | 24 this.setName(assertion.getUserID()); |
25 String account, | 25 this.setAccount(assertion.getNameID()); |
26 List<String> roles, | 26 this.setRoles(assertion.getRoles()); |
27 Assertion assertion, | |
28 List<String> features | |
29 ) { | |
30 this.setName(name); | |
31 this.setPassword(password); | |
32 this.setRoles(roles); | |
33 this.assertion = assertion; | 27 this.assertion = assertion; |
34 this.setAllowedFeatures(features); | 28 this.setAllowedFeatures(features); |
35 this.setAccount(account); | 29 this.setPassword(password); |
36 } | 30 } |
37 | 31 |
38 @Override | 32 @Override |
39 public boolean hasExpired() { | 33 public boolean hasExpired() { |
40 Date until = this.assertion.getUntil(); | 34 // We could check the validity dates of the assertion here, but |
41 if (until != null) { | 35 // when using this for Single-Sign-On this would lead to the |
42 Date current = new Date(); | 36 // code in GGInAFilter to re-authenticate with the password |
43 return !current.after(until); | 37 // stored in the User object, which isn't known in the case of |
44 } | 38 // Single-Sign-On. |
45 return false; | 39 return false; |
46 } | 40 } |
47 } | 41 } |
48 | 42 |
49 // vim:set ts=4 sw=4 si et fenc=utf8 tw=80: | 43 // vim:set ts=4 sw=4 si et fenc=utf8 tw=80: |