1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.opensaml.samlext.saml2delrestrict.impl;
18
19 import org.joda.time.DateTime;
20 import org.joda.time.chrono.ISOChronology;
21 import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller;
22 import org.opensaml.saml2.core.BaseID;
23 import org.opensaml.saml2.core.EncryptedID;
24 import org.opensaml.saml2.core.NameID;
25 import org.opensaml.samlext.saml2delrestrict.Delegate;
26 import org.opensaml.xml.XMLObject;
27 import org.opensaml.xml.io.UnmarshallingException;
28 import org.w3c.dom.Attr;
29
30
31
32
33 public class DelegateUnmarshaller extends AbstractSAMLObjectUnmarshaller {
34
35
36 protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
37 Delegate delegate = (Delegate) samlObject;
38
39 String attrName = attribute.getLocalName();
40 if (Delegate.CONFIRMATION_METHOD_ATTRIB_NAME.equals(attrName)) {
41 delegate.setConfirmationMethod(attribute.getValue());
42 } else if (Delegate.DELEGATION_INSTANT_ATTRIB_NAME.equals(attrName)) {
43 delegate.setDelegationInstant(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
44 } else {
45 super.processAttribute(samlObject, attribute);
46 }
47 }
48
49
50 protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
51 throws UnmarshallingException {
52 Delegate delegate = (Delegate) parentSAMLObject;
53
54 if (childSAMLObject instanceof BaseID) {
55 delegate.setBaseID((BaseID) childSAMLObject);
56 } else if (childSAMLObject instanceof NameID) {
57 delegate.setNameID((NameID) childSAMLObject);
58 } else if (childSAMLObject instanceof EncryptedID) {
59 delegate.setEncryptedID((EncryptedID) childSAMLObject);
60 } else {
61 super.processChildElement(parentSAMLObject, childSAMLObject);
62 }
63 }
64
65 }