Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/server/auth/saml/Assertion.java @ 8203:238fc722f87a
sed 's/logger/log/g' src/**/*.java
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 05 Sep 2014 13:19:22 +0200 |
parents | a51adfc957bf |
children | 2c8259176c46 |
comparison
equal
deleted
inserted
replaced
8202:e4606eae8ea5 | 8203:238fc722f87a |
---|---|
26 /** | 26 /** |
27 * Represents a SAML assertion about a user. | 27 * Represents a SAML assertion about a user. |
28 */ | 28 */ |
29 public class Assertion { | 29 public class Assertion { |
30 | 30 |
31 private static Logger logger = Logger.getLogger(Assertion.class); | 31 private static Logger log = Logger.getLogger(Assertion.class); |
32 | 32 |
33 private Element assertion; | 33 private Element assertion; |
34 private LinkedList<String> roles; | 34 private LinkedList<String> roles; |
35 private String user_id; | 35 private String user_id; |
36 private String name_id; | 36 private String name_id; |
58 | 58 |
59 private void parseCondition() { | 59 private void parseCondition() { |
60 Element conditions = (Element)XPathUtils.xpathNode(this.assertion, | 60 Element conditions = (Element)XPathUtils.xpathNode(this.assertion, |
61 "saml:Conditions"); | 61 "saml:Conditions"); |
62 if (conditions == null) { | 62 if (conditions == null) { |
63 logger.error("Cannot find Assertion conditions element"); | 63 log.error("Cannot find Assertion conditions element"); |
64 return; | 64 return; |
65 } | 65 } |
66 | 66 |
67 this.notbefore = parseDateAttribute(conditions, "NotBefore"); | 67 this.notbefore = parseDateAttribute(conditions, "NotBefore"); |
68 if (this.notbefore == null) { | 68 if (this.notbefore == null) { |
69 logger.warn("Could not extract NotBefore date."); | 69 log.warn("Could not extract NotBefore date."); |
70 } | 70 } |
71 this.notonorafter = parseDateAttribute(conditions, "NotOnOrAfter"); | 71 this.notonorafter = parseDateAttribute(conditions, "NotOnOrAfter"); |
72 if (this.notonorafter == null) { | 72 if (this.notonorafter == null) { |
73 logger.warn("Could not extract NotOnOrAfter date."); | 73 log.warn("Could not extract NotOnOrAfter date."); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 private Date parseDateAttribute(Element element, String name) { | 77 private Date parseDateAttribute(Element element, String name) { |
78 SimpleDateFormat dateformat = new SimpleDateFormat(); | 78 SimpleDateFormat dateformat = new SimpleDateFormat(); |
85 String value = element.getAttribute(name); | 85 String value = element.getAttribute(name); |
86 try { | 86 try { |
87 return toGMT(dateformat.parse(value)); | 87 return toGMT(dateformat.parse(value)); |
88 } | 88 } |
89 catch(ParseException e) { | 89 catch(ParseException e) { |
90 logger.error("Cannot parse Condition attribute " | 90 log.error("Cannot parse Condition attribute " |
91 + name + " with value " + value | 91 + name + " with value " + value |
92 + " (" + e.getLocalizedMessage() + ")"); | 92 + " (" + e.getLocalizedMessage() + ")"); |
93 } | 93 } |
94 return null; | 94 return null; |
95 } | 95 } |
104 | 104 |
105 private void parseAttributeStatement() { | 105 private void parseAttributeStatement() { |
106 Element attrstatement = (Element)XPathUtils.xpathNode(this.assertion, | 106 Element attrstatement = (Element)XPathUtils.xpathNode(this.assertion, |
107 "saml:AttributeStatement"); | 107 "saml:AttributeStatement"); |
108 if (attrstatement == null) { | 108 if (attrstatement == null) { |
109 logger.error("Cannot find Assertion AttributeStatement element"); | 109 log.error("Cannot find Assertion AttributeStatement element"); |
110 return; | 110 return; |
111 } | 111 } |
112 | 112 |
113 this.name_id = XPathUtils.xpathString(attrstatement, | 113 this.name_id = XPathUtils.xpathString(attrstatement, |
114 "saml:Subject" | 114 "saml:Subject" |