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.Username;
27 import org.opensaml.ws.wssecurity.UsernameToken;
28 import org.opensaml.xml.XMLObject;
29 import org.opensaml.xml.util.AttributeMap;
30 import org.opensaml.xml.util.IndexedXMLObjectChildrenList;
31
32
33
34
35 public class UsernameTokenImpl extends AbstractWSSecurityObject implements UsernameToken {
36
37
38 private String id;
39
40
41 private Username username;
42
43
44 private AttributeMap unknownAttributes;
45
46
47 private IndexedXMLObjectChildrenList<XMLObject> unknownChildren;
48
49
50
51
52
53
54
55
56 public UsernameTokenImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
57 super(namespaceURI, elementLocalName, namespacePrefix);
58 unknownAttributes = new AttributeMap(this);
59 unknownChildren = new IndexedXMLObjectChildrenList<XMLObject>(this);
60 }
61
62
63 public Username getUsername() {
64 return username;
65 }
66
67
68 public void setUsername(Username newUsername) {
69 username = prepareForAssignment(username, newUsername);
70 }
71
72
73 public String getWSUId() {
74 return id;
75 }
76
77
78 public void setWSUId(String newId) {
79 String oldId = id;
80 id = prepareForAssignment(id, newId);
81 registerOwnID(oldId, id);
82 }
83
84
85 public AttributeMap getUnknownAttributes() {
86 return unknownAttributes;
87 }
88
89
90 public List<XMLObject> getUnknownXMLObjects() {
91 return unknownChildren;
92 }
93
94
95 public List<XMLObject> getUnknownXMLObjects(QName typeOrName) {
96 return (List<XMLObject>) unknownChildren.subList(typeOrName);
97 }
98
99
100 public List<XMLObject> getOrderedChildren() {
101 ArrayList<XMLObject> children = new ArrayList<XMLObject>();
102 if (username != null) {
103 children.add(username);
104 }
105
106 if (!getUnknownXMLObjects().isEmpty()) {
107 children.addAll(getUnknownXMLObjects());
108 }
109 return Collections.unmodifiableList(children);
110 }
111
112 }