本文整理了Java中org.apache.ws.security.WSEncryptionPart
类的一些代码示例,展示了WSEncryptionPart
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WSEncryptionPart
类的具体详情如下:
包路径:org.apache.ws.security.WSEncryptionPart
类名称:WSEncryptionPart
暂无
代码示例来源:origin: org.apache.rampart/rampart-core
/**
* @param namespace
* The namespace of the part.
* @param element
* The part's element name.
*/
public void setEncryptedParts(String namespace, String element) {
WSEncryptionPart wep = new WSEncryptionPart(element, namespace,
"Element");
encryptedParts.add(wep);
}
代码示例来源:origin: org.apache.rampart/rampart-core
if (signedPart.getNamespace() == null || signedPart.getName() == null) {
continue;
if (encryptedPart.getNamespace() == null || encryptedPart.getName() == null) {
continue;
if (signedPart.getName().equals(encryptedPart.getName()) &&
signedPart.getNamespace().equals(encryptedPart.getNamespace())) {
String encDataID = encryptedPart.getEncId();
signedParts.remove(signedPart);
signedParts.add(createEncryptionPart(signedPart.getName(), encHeaderId,
signedPart.getNamespace(),
signedPart.getEncModifier(), signedPart.getXpath()));
代码示例来源:origin: org.apache.ws.security/wss4j
parts = new ArrayList<WSEncryptionPart>(1);
WSEncryptionPart encP =
new WSEncryptionPart(
WSConstants.ELEM_BODY,
soapNamespace,
} else {
for (WSEncryptionPart part : parts) {
if ("STRTransform".equals(part.getName()) && part.getId() == null) {
part.setId(strUri);
代码示例来源:origin: org.apache.rampart/rampart-core
/**
* Creates an encryption part. Could be a part or could be an element pointed through xpath expression.
* @param name Name of the element.
* @param id The id of the element
* @param namespace Namespace of the element.
* @param modifier Modifier "Content" or "Element"
* @param xPath The xPath expression
* @return A WSEncryptionPart
*/
public static WSEncryptionPart createEncryptionPart(String name, String id,
String namespace, String modifier,String xPath) {
// The part name must not be null !!
assert name != null;
WSEncryptionPart wsEncryptionPart = new WSEncryptionPart(name, namespace, modifier);
wsEncryptionPart.setId(id);
wsEncryptionPart.setXpath(xPath);
return wsEncryptionPart;
}
代码示例来源:origin: org.apache.ws.security/wss4j
/**
* Find the DOM Element in the SOAP Envelope that is referenced by the
* WSEncryptionPart argument. The "Id" is used before the Element localname/namespace.
*
* @param part The WSEncryptionPart object corresponding to the DOM Element(s) we want
* @param callbackLookup The CallbackLookup object used to find Elements
* @param doc The owning document
* @return the DOM Element in the SOAP Envelope that is found
*/
public static List<Element> findElements(
WSEncryptionPart part, CallbackLookup callbackLookup, Document doc
) throws WSSecurityException {
// See if the DOM Element is stored in the WSEncryptionPart first
if (part.getElement() != null) {
return Collections.singletonList(part.getElement());
}
// Next try to find the Element via its wsu:Id
String id = part.getId();
if (id != null) {
Element foundElement = callbackLookup.getElement(id, null, false);
return Collections.singletonList(foundElement);
}
// Otherwise just lookup all elements with the localname/namespace
return callbackLookup.getElements(part.getName(), part.getNamespace());
}
代码示例来源:origin: org.apache.ws.security/wss4j
WSEncryptionPart encP = new WSEncryptionPart(reqData.getSoapConstants()
.getBodyQName().getLocalPart(), reqData.getSoapConstants()
.getEnvelopeURI(), "Content");
boolean signTimestamp = false;
for (WSEncryptionPart encP : reqData.getSignatureParts()) {
if (WSConstants.WSU_NS.equals(encP.getNamespace())
&& "Timestamp".equals(encP.getName())) {
signTimestamp = true;
代码示例来源:origin: org.apache.ws.security/wss4j
WSSecurityException.FAILURE,
"noEncElement",
new Object[] {"{" + encPart.getNamespace() + "}" + encPart.getName()}
);
String modifier = encPart.getEncModifier();
for (Element elementToEncrypt : elementsToEncrypt) {
String id =
encryptElement(doc, elementToEncrypt, modifier, config, xmlCipher,
secretKey, keyInfo);
encPart.setEncId(id);
encDataRef.add("#" + id);
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j
boolean signBST = false;
for (WSEncryptionPart part : reqData.getSignatureParts()) {
if ("STRTransform".equals(part.getName()) && part.getId() == null) {
part.setId(wsSign.getSecurityTokenReferenceURI());
} else if (reqData.isAppendSignatureAfterTimestamp()
&& WSConstants.WSU_NS.equals(part.getNamespace())
&& "Timestamp".equals(part.getName())) {
int originalSignatureActionIndex =
reqData.getOriginalSignatureActionPosition();
} else if (WSConstants.WSSE_NS.equals(part.getNamespace())
&& WSConstants.BINARY_TOKEN_LN.equals(part.getName())) {
signBST = true;
代码示例来源:origin: org.apache.rampart/rampart-core
if (part.getName() == null) {
ArrayList headerList = header.getHeaderBlocksWithNSURI(part.getNamespace());
part.getNamespace(), "Content"));
} else {
part.getNamespace(), "Element"));
OMElement e = header.getFirstChildWithName(new QName(part.getNamespace(), part.getName()));
if (e != null) {
if (!found.contains(e)) {
part.setEncId(wsuId.getAttributeValue());
代码示例来源:origin: org.apache.rampart/rampart-core
if (wsep.getName().equals(WSConstants.ELEM_BODY)) {
} else if (wsep.getName().equals(WSConstants.ELEM_HEADER) ||
wsep.getXpath() != null) {
envelope, wsep.getName(), wsep.getNamespace());
String msg = wsep.getXpath() != null ?
"signedPartHeaderNotSigned" : "signedElementNotSigned";
throw new RampartException(msg, new String[]{wsep.getNamespace() + ":" + wsep.getName()});
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j
WSEncryptionPart encP = new WSEncryptionPart(reqData.getSoapConstants()
.getBodyQName().getLocalPart(), reqData.getSoapConstants()
.getEnvelopeURI(), "Content");
boolean signTimestamp = false;
for (WSEncryptionPart encP : reqData.getSignatureParts()) {
if (WSConstants.WSU_NS.equals(encP.getNamespace())
&& "Timestamp".equals(encP.getName())) {
signTimestamp = true;
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j
/**
* Find the DOM Element in the SOAP Envelope that is referenced by the
* WSEncryptionPart argument. The "Id" is used before the Element localname/namespace.
*
* @param part The WSEncryptionPart object corresponding to the DOM Element(s) we want
* @param callbackLookup The CallbackLookup object used to find Elements
* @param doc The owning document
* @return the DOM Element in the SOAP Envelope that is found
*/
public static List<Element> findElements(
WSEncryptionPart part, CallbackLookup callbackLookup, Document doc
) throws WSSecurityException {
// See if the DOM Element is stored in the WSEncryptionPart first
if (part.getElement() != null) {
return Collections.singletonList(part.getElement());
}
// Next try to find the Element via its wsu:Id
String id = part.getId();
if (id != null) {
Element foundElement = callbackLookup.getElement(id, null, false);
return Collections.singletonList(foundElement);
}
// Otherwise just lookup all elements with the localname/namespace
return callbackLookup.getElements(part.getName(), part.getNamespace());
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j
WSSecurityException.FAILURE,
"noEncElement",
new Object[] {"{" + encPart.getNamespace() + "}" + encPart.getName()}
);
String modifier = encPart.getEncModifier();
for (Element elementToEncrypt : elementsToEncrypt) {
String id =
encryptElement(doc, elementToEncrypt, modifier, config, xmlCipher,
secretKey, keyInfo);
encPart.setEncId(id);
encDataRef.add("#" + id);
代码示例来源:origin: org.apache.ws.security/wss4j
boolean signBST = false;
for (WSEncryptionPart part : reqData.getSignatureParts()) {
if ("STRTransform".equals(part.getName()) && part.getId() == null) {
part.setId(wsSign.getSecurityTokenReferenceURI());
} else if (reqData.isAppendSignatureAfterTimestamp()
&& WSConstants.WSU_NS.equals(part.getNamespace())
&& "Timestamp".equals(part.getName())) {
int originalSignatureActionIndex =
reqData.getOriginalSignatureActionPosition();
} else if (WSConstants.WSSE_NS.equals(part.getNamespace())
&& WSConstants.BINARY_TOKEN_LN.equals(part.getName())) {
signBST = true;
代码示例来源:origin: org.apache.rampart/rampart-core
/**
* @param namespace
* The namespace of the part.
* @param element
* The part's element name.
*/
public void addSignedPart(String namespace, String element) {
WSEncryptionPart wep = new WSEncryptionPart(element, namespace,
"Content");
signedParts.add(wep);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j
parts = new ArrayList<WSEncryptionPart>(1);
WSEncryptionPart encP =
new WSEncryptionPart(
WSConstants.ELEM_BODY,
soapNamespace,
} else {
for (WSEncryptionPart part : parts) {
if ("STRTransform".equals(part.getName()) && part.getId() == null) {
part.setId(strUri);
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j
String idToSign = encPart.getId();
String elemName = encPart.getName();
Element element = encPart.getElement();
referenceList.add(reference);
} else {
String nmSpace = encPart.getNamespace();
List<Element> elementsToSign = null;
if (element != null) {
代码示例来源:origin: org.apache.rampart/rampart-core
if (encryptedPart.getName().equals(WSConstants.ELEM_BODY)) {
continue;
if ((WSConstants.SIG_LN.equals(encryptedPart.getName()) &&
WSConstants.SIG_NS.equals(encryptedPart.getNamespace()))
|| encryptedPart.getEncModifier().equals(WSConstants.ELEM_HEADER)) {
if (!isRefIdPresent(encrRefs, new QName(encryptedPart.getNamespace(), encryptedPart.getName()))) {
throw new RampartException("encryptedPartMissing",
new String[]{encryptedPart.getNamespace() + ":" + encryptedPart.getName()});
String xpath = encryptedPart.getXpath();
boolean found = false;
try {
Object result = decryptedElements.get(o);
if (result != null &&
("Element".equals(encryptedPart.getEncModifier())
^ (Boolean) result)) {
found = true;
代码示例来源:origin: org.apache.rampart/rampart-core
/**
* @param namespace
* The namespace of the part.
* @param element
* The part's element name.
* @param modifier
* The type of encryption
* Element,Content,Header
*/
public void setEncryptedParts(String namespace, String element,
String modifier) {
WSEncryptionPart wep = new WSEncryptionPart(element, namespace,
modifier);
encryptedParts.add(wep);
}
代码示例来源:origin: org.apache.ws.security/wss4j
String soapNamespace = WSSecurityUtil.getSOAPNamespace(doc.getDocumentElement());
WSEncryptionPart encP =
new WSEncryptionPart(
WSConstants.ELEM_BODY,
soapNamespace,
} else {
for (WSEncryptionPart part : parts) {
if ("STRTransform".equals(part.getName()) && part.getId() == null) {
part.setId(strUri);
内容来源于网络,如有侵权,请联系作者删除!