本文整理汇总了Java中org.opensaml.xml.XMLObject类的典型用法代码示例。如果您正苦于以下问题:Java XMLObject类的具体用法?Java XMLObject怎么用?Java XMLObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XMLObject类属于org.opensaml.xml包,在下文中一共展示了XMLObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processFaultResponse
import org.opensaml.xml.XMLObject; //导入依赖的package包/类
/**
* Processes a SOAP fault, as determined by an HTTP 500 status code, response.
*
* @param httpMethod the HTTP method used to send the request and receive the response
* @param messageContext current messages context
*
* @throws SOAPClientException thrown if the response can not be read from the {@link PostMethod}
* @throws SOAPFaultException an exception containing the SOAP fault
*/
protected void processFaultResponse(PostMethod httpMethod, SOAPMessageContext messageContext)
throws SOAPClientException, SOAPFaultException {
try {
Envelope response = unmarshallResponse(httpMethod.getResponseBodyAsStream());
messageContext.setInboundMessage(response);
List<XMLObject> faults = response.getBody().getUnknownXMLObjects(Fault.DEFAULT_ELEMENT_NAME);
if (faults.size() < 1) {
throw new SOAPClientException("HTTP status code was 500 but SOAP response did not contain a Fault");
}
Fault fault = (Fault) faults.get(0);
log.debug("SOAP fault code {} with message {}", fault.getCode().getValue(), fault.getMessage().getValue());
SOAPFaultException faultException = new SOAPFaultException("SOAP Fault: " + fault.getCode().getValue()
+ " Fault Message: " + fault.getMessage().getValue());
faultException.setFault(fault);
throw faultException;
} catch (IOException e) {
throw new SOAPClientException("Unable to read response", e);
}
}
示例2: getOrderedChildren
import org.opensaml.xml.XMLObject; //导入依赖的package包/类
/** {@inheritDoc} */
public List<XMLObject> getOrderedChildren() {
ArrayList<XMLObject> children = new ArrayList<XMLObject>();
if (super.getOrderedChildren() != null) {
children.addAll(super.getOrderedChildren());
}
children.addAll(indexedChildren);
if (children.size() == 0) {
return null;
}
return Collections.unmodifiableList(children);
}
示例3: findCertFromDigest
import org.opensaml.xml.XMLObject; //导入依赖的package包/类
/**
* Find the certificate from the chain that matches one of the specified digests.
*
* @param certs list of certificates to evaluate
* @param digests X509 digests to use as search criteria
* @return the matching certificate, or null
*/
protected X509Certificate findCertFromDigest(List<X509Certificate> certs, List<XMLObject> digests) {
byte[] certValue;
byte[] xmlValue;
for (XMLObject xo : digests) {
if (!(xo instanceof X509Digest)) {
continue;
}
X509Digest digest = (X509Digest) xo;
if (!DatatypeHelper.isEmpty(digest.getValue())) {
xmlValue = Base64.decode(digest.getValue());
for (X509Certificate cert : certs) {
try {
certValue = X509Util.getX509Digest(cert, digest.getAlgorithm());
if (certValue != null && Arrays.equals(xmlValue, certValue)) {
return cert;
}
} catch (SecurityException e) {
// Ignore as no match.
}
}
}
}
return null;
}
示例4: processAttribute
import org.opensaml.xml.XMLObject; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
AuthorizationDecisionStatement authorizationDecisionStatement;
authorizationDecisionStatement = (AuthorizationDecisionStatement) samlObject;
if (AuthorizationDecisionStatement.DECISION_ATTRIB_NAME.equals(attribute.getLocalName())) {
String value = attribute.getValue();
if (value.equals(DecisionTypeEnumeration.PERMIT.toString())) {
authorizationDecisionStatement.setDecision(DecisionTypeEnumeration.PERMIT);
} else if (value.equals(DecisionTypeEnumeration.DENY.toString())) {
authorizationDecisionStatement.setDecision(DecisionTypeEnumeration.DENY);
} else if (value.equals(DecisionTypeEnumeration.INDETERMINATE.toString())) {
authorizationDecisionStatement.setDecision(DecisionTypeEnumeration.INDETERMINATE);
} else {
log.error("Unknown value for DecisionType '" + value + "'");
throw new UnmarshallingException("Unknown value for DecisionType '" + value + "'");
}
} else if (AuthorizationDecisionStatement.RESOURCE_ATTRIB_NAME.equals(attribute.getLocalName())) {
authorizationDecisionStatement.setResource(attribute.getValue());
} else {
super.processAttribute(samlObject, attribute);
}
}
示例5: marshallAttributes
import org.opensaml.xml.XMLObject; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
LogoutRequest req = (LogoutRequest) samlObject;
if (req.getReason() != null) {
domElement.setAttributeNS(null, LogoutRequest.REASON_ATTRIB_NAME, req.getReason());
}
if (req.getNotOnOrAfter() != null) {
String noaStr = Configuration.getSAMLDateFormatter().print(req.getNotOnOrAfter());
domElement.setAttributeNS(null, LogoutRequest.NOT_ON_OR_AFTER_ATTRIB_NAME, noaStr);
}
super.marshallAttributes(samlObject, domElement);
}
示例6: processChildElement
import org.opensaml.xml.XMLObject; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
throws UnmarshallingException {
NameIDMappingRequest req = (NameIDMappingRequest) parentSAMLObject;
if (childSAMLObject instanceof BaseID) {
req.setBaseID((BaseID) childSAMLObject);
} else if (childSAMLObject instanceof NameID) {
req.setNameID((NameID) childSAMLObject);
} else if (childSAMLObject instanceof EncryptedID) {
req.setEncryptedID((EncryptedID) childSAMLObject);
} else if (childSAMLObject instanceof NameIDPolicy) {
req.setNameIDPolicy((NameIDPolicy) childSAMLObject);
} else {
super.processChildElement(parentSAMLObject, childSAMLObject);
}
}
示例7: getOrderedChildren
import org.opensaml.xml.XMLObject; //导入依赖的package包/类
/** {@inheritDoc} */
public List<XMLObject> getOrderedChildren() {
ArrayList<XMLObject> children = new ArrayList<XMLObject>();
if (decision != null) {
children.add(decision);
}
if (status != null) {
children.add(status);
}
if (obligations != null) {
children.add(obligations);
}
return Collections.unmodifiableList(children);
}
示例8: processChildElement
import org.opensaml.xml.XMLObject; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
throws UnmarshallingException {
ManageNameIDRequest req = (ManageNameIDRequest) parentSAMLObject;
if (childSAMLObject instanceof NameID) {
req.setNameID((NameID) childSAMLObject);
} else if (childSAMLObject instanceof EncryptedID) {
req.setEncryptedID((EncryptedID) childSAMLObject);
} else if (childSAMLObject instanceof NewID) {
req.setNewID((NewID) childSAMLObject);
} else if (childSAMLObject instanceof NewEncryptedID) {
req.setNewEncryptedID((NewEncryptedID) childSAMLObject);
} else if (childSAMLObject instanceof Terminate) {
req.setTerminate((Terminate) childSAMLObject);
} else {
super.processChildElement(parentSAMLObject, childSAMLObject);
}
}
示例9: getOrderedChildren
import org.opensaml.xml.XMLObject; //导入依赖的package包/类
/** {@inheritDoc} */
public List<XMLObject> getOrderedChildren() {
ArrayList<XMLObject> children = new ArrayList<XMLObject>();
if (encryptedData != null) {
children.add(encryptedData);
}
children.addAll(encryptedKeys);
if (children.size() == 0) {
return null;
}
return Collections.unmodifiableList(children);
}
示例10: checkAndMarshall
import org.opensaml.xml.XMLObject; //导入依赖的package包/类
/**
* Ensure that the XMLObject is marshalled.
*
* @param xmlObject the object to check and marshall
* @throws DecryptionException thrown if there is an error when marshalling the XMLObject
*/
protected void checkAndMarshall(XMLObject xmlObject) throws DecryptionException {
Element targetElement = xmlObject.getDOM();
if (targetElement == null) {
Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(xmlObject);
if (marshaller == null) {
marshaller =
Configuration.getMarshallerFactory().getMarshaller(Configuration.getDefaultProviderQName());
if (marshaller == null) {
String errorMsg = "No marshaller available for " + xmlObject.getElementQName();
log.error(errorMsg);
throw new DecryptionException(errorMsg);
}
}
try {
targetElement = marshaller.marshall(xmlObject);
} catch (MarshallingException e) {
log.error("Error marshalling target XMLObject", e);
throw new DecryptionException("Error marshalling target XMLObject", e);
}
}
}
示例11: getOrderedChildren
import org.opensaml.xml.XMLObject; //导入依赖的package包/类
/** {@inheritDoc} */
public List<XMLObject> getOrderedChildren() {
ArrayList<XMLObject> children = new ArrayList<XMLObject>();
children.addAll(encTypes);
if (keyInfo != null) {
children.add(keyInfo);
}
return Collections.unmodifiableList(children);
}
示例12: marshallAttributes
import org.opensaml.xml.XMLObject; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
ECKeyValue ec = (ECKeyValue) xmlObject;
if (ec.getID() != null) {
domElement.setAttributeNS(null, ECKeyValue.ID_ATTRIB_NAME, ec.getID());
domElement.setIdAttributeNS(null, ECKeyValue.ID_ATTRIB_NAME, true);
}
}
示例13: processChildElement
import org.opensaml.xml.XMLObject; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
throws UnmarshallingException {
AttributeQueryDescriptorType descriptor = (AttributeQueryDescriptorType) parentSAMLObject;
if (childSAMLObject instanceof AttributeConsumingService) {
descriptor.getAttributeConsumingServices().add((AttributeConsumingService) childSAMLObject);
} else {
super.processChildElement(parentSAMLObject, childSAMLObject);
}
}
示例14: processAttribute
import org.opensaml.xml.XMLObject; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
if(attribute.getLocalName().equals(FunctionType.FUNCTION_ID_ATTRIB_NAME)){
FunctionType functionType = (FunctionType) xmlObject;
functionType.setFunctionId(DatatypeHelper.safeTrimOrNullString(attribute.getValue()));
} else {
super.processAttribute(xmlObject, attribute);
}
}
示例15: marshallElementContent
import org.opensaml.xml.XMLObject; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException {
X509SerialNumber x509SerialNumber = (X509SerialNumber) xmlObject;
if (x509SerialNumber.getValue() != null) {
XMLHelper.appendTextContent(domElement, x509SerialNumber.getValue().toString());
}
}