1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.opensaml.saml2.metadata.impl;
22
23 import org.opensaml.saml2.metadata.AssertionConsumerService;
24 import org.opensaml.saml2.metadata.AttributeConsumingService;
25 import org.opensaml.saml2.metadata.SPSSODescriptor;
26 import org.opensaml.xml.XMLObject;
27 import org.opensaml.xml.io.UnmarshallingException;
28 import org.opensaml.xml.schema.XSBooleanValue;
29 import org.w3c.dom.Attr;
30
31
32
33
34 public class SPSSODescriptorUnmarshaller extends SSODescriptorUnmarshaller {
35
36
37 protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
38 throws UnmarshallingException {
39 SPSSODescriptor descriptor = (SPSSODescriptor) parentSAMLObject;
40
41 if (childSAMLObject instanceof AssertionConsumerService) {
42 descriptor.getAssertionConsumerServices().add((AssertionConsumerService) childSAMLObject);
43 } else if (childSAMLObject instanceof AttributeConsumingService) {
44 descriptor.getAttributeConsumingServices().add((AttributeConsumingService) childSAMLObject);
45 } else {
46 super.processChildElement(parentSAMLObject, childSAMLObject);
47 }
48 }
49
50
51 protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
52 SPSSODescriptor descriptor = (SPSSODescriptor) samlObject;
53
54 if (attribute.getLocalName().equals(SPSSODescriptor.AUTH_REQUESTS_SIGNED_ATTRIB_NAME)) {
55 descriptor.setAuthnRequestsSigned(XSBooleanValue.valueOf(attribute.getValue()));
56 } else if (attribute.getLocalName().equals(SPSSODescriptor.WANT_ASSERTIONS_SIGNED_ATTRIB_NAME)) {
57 descriptor.setWantAssertionsSigned(XSBooleanValue.valueOf(attribute.getValue()));
58 } else {
59 super.processAttribute(samlObject, attribute);
60 }
61 }
62 }