org.opensaml.soap.wssecurity.impl.EncryptedHeaderImpl Maven / Gradle / Ivy
/*
* Licensed to the University Corporation for Advanced Internet Development,
* Inc. (UCAID) under one or more contributor license agreements. See the
* NOTICE file distributed with this work for additional information regarding
* copyright ownership. The UCAID licenses this file to You under the Apache
* License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.opensaml.soap.wssecurity.impl;
import java.util.Collections;
import java.util.List;
import net.shibboleth.utilities.java.support.collection.LazyList;
import org.opensaml.core.xml.XMLObject;
import org.opensaml.core.xml.schema.XSBooleanValue;
import org.opensaml.soap.soap11.ActorBearing;
import org.opensaml.soap.soap11.MustUnderstandBearing;
import org.opensaml.soap.soap12.RelayBearing;
import org.opensaml.soap.soap12.RoleBearing;
import org.opensaml.soap.wssecurity.EncryptedHeader;
import org.opensaml.soap.wssecurity.IdBearing;
import org.opensaml.xmlsec.encryption.EncryptedData;
/**
* Implementation of {@link EncryptedHeader}.
*/
public class EncryptedHeaderImpl extends AbstractWSSecurityObject implements EncryptedHeader {
/** EncryptedData child element. */
private EncryptedData encryptedData;
/** The @wsu:Id
atribute. */
private String wsuId;
/** The @soap11:mustUnderstand
atribute. */
private XSBooleanValue soap11MustUnderstand;
/** The @soap11:actor
atribute. */
private String soap11Actor;
/** The @soap12:mustUnderstand
atribute. */
private XSBooleanValue soap12MustUnderstand;
/** The @soap12:role
atribute. */
private String soap12Role;
/** The @soap12:relay
atribute. */
private XSBooleanValue soap12Relay;
/**
* Constructor.
*
* @param namespaceURI namespace of the element
* @param elementLocalName name of the element
* @param namespacePrefix namespace prefix of the element
*/
public EncryptedHeaderImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
public EncryptedData getEncryptedData() {
return encryptedData;
}
/** {@inheritDoc} */
public void setEncryptedData(EncryptedData newEncryptedData) {
encryptedData = prepareForAssignment(encryptedData, newEncryptedData);
}
/** {@inheritDoc} */
public String getWSUId() {
return wsuId;
}
/** {@inheritDoc} */
public void setWSUId(String newId) {
String oldId = wsuId;
wsuId = prepareForAssignment(wsuId, newId);
registerOwnID(oldId, wsuId);
manageQualifiedAttributeNamespace(IdBearing.WSU_ID_ATTR_NAME, wsuId != null);
}
/** {@inheritDoc} */
public Boolean isSOAP11MustUnderstand() {
if (soap11MustUnderstand != null) {
return soap11MustUnderstand.getValue();
}
return Boolean.FALSE;
}
/** {@inheritDoc} */
public XSBooleanValue isSOAP11MustUnderstandXSBoolean() {
return soap11MustUnderstand;
}
/** {@inheritDoc} */
public void setSOAP11MustUnderstand(Boolean newMustUnderstand) {
if (newMustUnderstand != null) {
soap11MustUnderstand = prepareForAssignment(soap11MustUnderstand,
new XSBooleanValue(newMustUnderstand, true));
} else {
soap11MustUnderstand = prepareForAssignment(soap11MustUnderstand, null);
}
manageQualifiedAttributeNamespace(MustUnderstandBearing.SOAP11_MUST_UNDERSTAND_ATTR_NAME,
soap11MustUnderstand != null);
}
/** {@inheritDoc} */
public void setSOAP11MustUnderstand(XSBooleanValue newMustUnderstand) {
soap11MustUnderstand = prepareForAssignment(soap11MustUnderstand, newMustUnderstand);
manageQualifiedAttributeNamespace(MustUnderstandBearing.SOAP11_MUST_UNDERSTAND_ATTR_NAME,
soap11MustUnderstand != null);
}
/** {@inheritDoc} */
public String getSOAP11Actor() {
return soap11Actor;
}
/** {@inheritDoc} */
public void setSOAP11Actor(String newActor) {
soap11Actor = prepareForAssignment(soap11Actor, newActor);
manageQualifiedAttributeNamespace(ActorBearing.SOAP11_ACTOR_ATTR_NAME, soap11Actor != null);
}
/** {@inheritDoc} */
public Boolean isSOAP12MustUnderstand() {
if (soap12MustUnderstand != null) {
return soap12MustUnderstand.getValue();
}
return Boolean.FALSE;
}
/** {@inheritDoc} */
public XSBooleanValue isSOAP12MustUnderstandXSBoolean() {
return soap12MustUnderstand;
}
/** {@inheritDoc} */
public void setSOAP12MustUnderstand(Boolean newMustUnderstand) {
if (newMustUnderstand != null) {
soap12MustUnderstand = prepareForAssignment(soap12MustUnderstand,
new XSBooleanValue(newMustUnderstand, false));
} else {
soap12MustUnderstand = prepareForAssignment(soap12MustUnderstand, null);
}
manageQualifiedAttributeNamespace(SOAP12_MUST_UNDERSTAND_ATTR_NAME, soap12MustUnderstand != null);
}
/** {@inheritDoc} */
public void setSOAP12MustUnderstand(XSBooleanValue newMustUnderstand) {
soap12MustUnderstand = prepareForAssignment(soap12MustUnderstand, newMustUnderstand);
manageQualifiedAttributeNamespace(SOAP12_MUST_UNDERSTAND_ATTR_NAME, soap12MustUnderstand != null);
}
/** {@inheritDoc} */
public String getSOAP12Role() {
return soap12Role;
}
/** {@inheritDoc} */
public void setSOAP12Role(String newRole) {
soap12Role = prepareForAssignment(soap12Role, newRole);
manageQualifiedAttributeNamespace(RoleBearing.SOAP12_ROLE_ATTR_NAME, soap12Role != null);
}
/** {@inheritDoc} */
public Boolean isSOAP12Relay() {
if (soap12Relay != null) {
return soap12Relay.getValue();
}
return Boolean.FALSE;
}
/** {@inheritDoc} */
public XSBooleanValue isSOAP12RelayXSBoolean() {
return soap12Relay;
}
/** {@inheritDoc} */
public void setSOAP12Relay(Boolean newRelay) {
if (newRelay != null) {
soap12Relay = prepareForAssignment(soap12Relay,
new XSBooleanValue(newRelay, false));
} else {
soap12Relay = prepareForAssignment(soap12Relay, null);
}
manageQualifiedAttributeNamespace(RelayBearing.SOAP12_RELAY_ATTR_NAME, soap12Relay != null);
}
/** {@inheritDoc} */
public void setSOAP12Relay(XSBooleanValue newRelay) {
soap12Relay = prepareForAssignment(soap12Relay, newRelay);
manageQualifiedAttributeNamespace(RelayBearing.SOAP12_RELAY_ATTR_NAME, soap12Relay != null);
}
/** {@inheritDoc} */
public List getOrderedChildren() {
LazyList children = new LazyList();
if (encryptedData != null) {
children.add(encryptedData);
}
return Collections.unmodifiableList(children);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy