1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.commons.ihe.xua;
17
18 import org.opensaml.core.xml.XMLObject;
19 import org.opensaml.core.xml.io.UnmarshallingException;
20 import org.opensaml.saml.saml2.core.AttributeStatement;
21 import org.opensaml.saml.saml2.core.SubjectConfirmation;
22 import org.opensaml.saml.saml2.core.impl.AttributeStatementBuilder;
23 import org.opensaml.saml.saml2.core.impl.AttributeStatementUnmarshaller;
24
25 import java.util.List;
26
27
28
29
30
31
32
33 public class AttributeStatementExtractor extends AttributeStatementUnmarshaller {
34
35 public AttributeStatement extractAttributeStatement(SubjectConfirmation subjectConfirmation) {
36 AttributeStatement attributeStatement = new AttributeStatementBuilder().buildObject();
37 List<XMLObject> xmlObjectList = subjectConfirmation.getSubjectConfirmationData().getUnknownXMLObjects(AttributeStatement.DEFAULT_ELEMENT_NAME);
38 for (XMLObject xmlObject : xmlObjectList) {
39 for (XMLObject child : xmlObject.getOrderedChildren()) {
40 try {
41 child.detach();
42 processChildElement(attributeStatement, child);
43 } catch (UnmarshallingException e) {
44
45 }
46 }
47 }
48 return attributeStatement;
49 }
50
51 }