1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.opensaml.ws.wssecurity.impl;
19
20 import java.util.ArrayList;
21 import java.util.Collections;
22 import java.util.List;
23
24 import javax.xml.namespace.QName;
25
26 import org.opensaml.ws.wssecurity.IdBearing;
27 import org.opensaml.ws.wssecurity.SecurityTokenReference;
28 import org.opensaml.ws.wssecurity.UsageBearing;
29 import org.opensaml.xml.XMLObject;
30 import org.opensaml.xml.util.AttributeMap;
31 import org.opensaml.xml.util.IndexedXMLObjectChildrenList;
32
33
34
35
36
37 public class SecurityTokenReferenceImpl extends AbstractWSSecurityObject implements SecurityTokenReference {
38
39
40 private String id;
41
42
43 private List<String> usages;
44
45
46 private AttributeMap unknownAttributes;
47
48
49 private IndexedXMLObjectChildrenList<XMLObject> unknownChildren;
50
51
52
53
54
55
56
57
58 public SecurityTokenReferenceImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
59 super(namespaceURI, elementLocalName, namespacePrefix);
60 usages = new ArrayList<String>();
61 unknownAttributes = new AttributeMap(this);
62 unknownChildren = new IndexedXMLObjectChildrenList<XMLObject>(this);
63 }
64
65
66
67 public List<String> getWSSEUsages() {
68 return usages;
69 }
70
71
72 public void setWSSEUsages(List<String> newUsages) {
73 usages = prepareForAssignment(usages, newUsages);
74 manageQualifiedAttributeNamespace(UsageBearing.WSSE_USAGE_ATTR_NAME, !usages.isEmpty());
75 }
76
77
78 public String getWSUId() {
79 return id;
80 }
81
82
83 public void setWSUId(String newId) {
84 String oldId = id;
85 id = prepareForAssignment(id, newId);
86 registerOwnID(oldId, id);
87 manageQualifiedAttributeNamespace(IdBearing.WSU_ID_ATTR_NAME, id != null);
88 }
89
90
91
92 public AttributeMap getUnknownAttributes() {
93 return unknownAttributes;
94 }
95
96
97 public List<XMLObject> getUnknownXMLObjects() {
98 return unknownChildren;
99 }
100
101
102 public List<XMLObject> getUnknownXMLObjects(QName typeOrName) {
103 return (List<XMLObject>) unknownChildren.subList(typeOrName);
104 }
105
106
107 public List<XMLObject> getOrderedChildren() {
108 List<XMLObject> children = new ArrayList<XMLObject>();
109
110 if (!getUnknownXMLObjects().isEmpty()) {
111 children.addAll(getUnknownXMLObjects());
112 }
113 return Collections.unmodifiableList(children);
114 }
115
116 }