1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.opensaml.ws.wssecurity.impl;
18
19 import java.util.Collections;
20 import java.util.List;
21
22 import org.opensaml.ws.soap.soap11.ActorBearing;
23 import org.opensaml.ws.soap.soap11.MustUnderstandBearing;
24 import org.opensaml.ws.soap.soap12.RelayBearing;
25 import org.opensaml.ws.soap.soap12.RoleBearing;
26 import org.opensaml.ws.wssecurity.EncryptedHeader;
27 import org.opensaml.ws.wssecurity.IdBearing;
28 import org.opensaml.xml.XMLObject;
29 import org.opensaml.xml.encryption.EncryptedData;
30 import org.opensaml.xml.schema.XSBooleanValue;
31 import org.opensaml.xml.util.LazyList;
32
33
34
35
36 public class EncryptedHeaderImpl extends AbstractWSSecurityObject implements EncryptedHeader {
37
38
39 private EncryptedData encryptedData;
40
41
42 private String wsuId;
43
44
45 private XSBooleanValue soap11MustUnderstand;
46
47
48 private String soap11Actor;
49
50
51 private XSBooleanValue soap12MustUnderstand;
52
53
54 private String soap12Role;
55
56
57 private XSBooleanValue soap12Relay;
58
59
60
61
62
63
64
65
66 public EncryptedHeaderImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
67 super(namespaceURI, elementLocalName, namespacePrefix);
68 }
69
70
71 public EncryptedData getEncryptedData() {
72 return encryptedData;
73 }
74
75
76 public void setEncryptedData(EncryptedData newEncryptedData) {
77 encryptedData = prepareForAssignment(encryptedData, newEncryptedData);
78 }
79
80
81 public String getWSUId() {
82 return wsuId;
83 }
84
85
86 public void setWSUId(String newId) {
87 String oldId = wsuId;
88 wsuId = prepareForAssignment(wsuId, newId);
89 registerOwnID(oldId, wsuId);
90 manageQualifiedAttributeNamespace(IdBearing.WSU_ID_ATTR_NAME, wsuId != null);
91 }
92
93
94 public Boolean isSOAP11MustUnderstand() {
95 if (soap11MustUnderstand != null) {
96 return soap11MustUnderstand.getValue();
97 }
98 return Boolean.FALSE;
99 }
100
101
102 public XSBooleanValue isSOAP11MustUnderstandXSBoolean() {
103 return soap11MustUnderstand;
104 }
105
106
107 public void setSOAP11MustUnderstand(Boolean newMustUnderstand) {
108 if (newMustUnderstand != null) {
109 soap11MustUnderstand = prepareForAssignment(soap11MustUnderstand,
110 new XSBooleanValue(newMustUnderstand, true));
111 } else {
112 soap11MustUnderstand = prepareForAssignment(soap11MustUnderstand, null);
113 }
114 manageQualifiedAttributeNamespace(MustUnderstandBearing.SOAP11_MUST_UNDERSTAND_ATTR_NAME,
115 soap11MustUnderstand != null);
116 }
117
118
119 public void setSOAP11MustUnderstand(XSBooleanValue newMustUnderstand) {
120 soap11MustUnderstand = prepareForAssignment(soap11MustUnderstand, newMustUnderstand);
121 manageQualifiedAttributeNamespace(MustUnderstandBearing.SOAP11_MUST_UNDERSTAND_ATTR_NAME,
122 soap11MustUnderstand != null);
123 }
124
125
126 public String getSOAP11Actor() {
127 return soap11Actor;
128 }
129
130
131 public void setSOAP11Actor(String newActor) {
132 soap11Actor = prepareForAssignment(soap11Actor, newActor);
133 manageQualifiedAttributeNamespace(ActorBearing.SOAP11_ACTOR_ATTR_NAME, soap11Actor != null);
134 }
135
136
137 public Boolean isSOAP12MustUnderstand() {
138 if (soap12MustUnderstand != null) {
139 return soap12MustUnderstand.getValue();
140 }
141 return Boolean.FALSE;
142 }
143
144
145 public XSBooleanValue isSOAP12MustUnderstandXSBoolean() {
146 return soap12MustUnderstand;
147 }
148
149
150 public void setSOAP12MustUnderstand(Boolean newMustUnderstand) {
151 if (newMustUnderstand != null) {
152 soap12MustUnderstand = prepareForAssignment(soap12MustUnderstand,
153 new XSBooleanValue(newMustUnderstand, false));
154 } else {
155 soap12MustUnderstand = prepareForAssignment(soap12MustUnderstand, null);
156 }
157 manageQualifiedAttributeNamespace(org.opensaml.ws.soap.soap12.MustUnderstandBearing.SOAP12_MUST_UNDERSTAND_ATTR_NAME,
158 soap12MustUnderstand != null);
159 }
160
161
162 public void setSOAP12MustUnderstand(XSBooleanValue newMustUnderstand) {
163 soap12MustUnderstand = prepareForAssignment(soap12MustUnderstand, newMustUnderstand);
164 manageQualifiedAttributeNamespace(org.opensaml.ws.soap.soap12.MustUnderstandBearing.SOAP12_MUST_UNDERSTAND_ATTR_NAME,
165 soap12MustUnderstand != null);
166 }
167
168
169 public String getSOAP12Role() {
170 return soap12Role;
171 }
172
173
174 public void setSOAP12Role(String newRole) {
175 soap12Role = prepareForAssignment(soap12Role, newRole);
176 manageQualifiedAttributeNamespace(RoleBearing.SOAP12_ROLE_ATTR_NAME, soap12Role != null);
177 }
178
179
180 public Boolean isSOAP12Relay() {
181 if (soap12Relay != null) {
182 return soap12Relay.getValue();
183 }
184 return Boolean.FALSE;
185 }
186
187
188 public XSBooleanValue isSOAP12RelayXSBoolean() {
189 return soap12Relay;
190 }
191
192
193 public void setSOAP12Relay(Boolean newRelay) {
194 if (newRelay != null) {
195 soap12Relay = prepareForAssignment(soap12Relay,
196 new XSBooleanValue(newRelay, false));
197 } else {
198 soap12Relay = prepareForAssignment(soap12Relay, null);
199 }
200 manageQualifiedAttributeNamespace(RelayBearing.SOAP12_RELAY_ATTR_NAME, soap12Relay != null);
201 }
202
203
204 public void setSOAP12Relay(XSBooleanValue newRelay) {
205 soap12Relay = prepareForAssignment(soap12Relay, newRelay);
206 manageQualifiedAttributeNamespace(RelayBearing.SOAP12_RELAY_ATTR_NAME, soap12Relay != null);
207 }
208
209
210 public List<XMLObject> getOrderedChildren() {
211 LazyList<XMLObject> children = new LazyList<XMLObject>();
212 if (encryptedData != null) {
213 children.add(encryptedData);
214 }
215 return Collections.unmodifiableList(children);
216 }
217
218 }