private static boolean matchElement(Collection<WSDataRef> refs, CoverageType type, CoverageScope scope, Element el) { final boolean content; switch (scope) { case CONTENT: content = true; break; case ELEMENT: default: content = false; } for (WSDataRef r : refs) { // If the element is the same object instance // as that in the ref, we found it and can // stop looking at this element. if (r.getProtectedElement() == el && r.isContent() == content) { return true; } } return false; }
private static boolean matchElement(Collection<WSDataRef> refs, CoverageType type, CoverageScope scope, Element el) { final boolean content; switch (scope) { case CONTENT: content = true; break; case ELEMENT: default: content = false; } for (WSDataRef r : refs) { // If the element is the same object instance // as that in the ref, we found it and can // stop looking at this element. if (r.getProtectedElement() == el && r.isContent() == content) { return true; } } return false; }
/** * Check that an Element is signed or encrypted by one of the token results */ private boolean checkProtectionResult( Element elementToProtect, boolean content, List<WSSecurityEngineResult> protResults, List<WSSecurityEngineResult> tokenResults ) { elementToProtect = (Element)DOMUtils.getDomElement(elementToProtect); for (WSSecurityEngineResult result : protResults) { List<WSDataRef> dataRefs = CastUtils.cast((List<?>)result.get(WSSecurityEngineResult.TAG_DATA_REF_URIS)); if (dataRefs != null) { for (WSDataRef dataRef : dataRefs) { if (elementToProtect == dataRef.getProtectedElement() && content == dataRef.isContent() && checkSignatureOrEncryptionResult(result, tokenResults)) { return true; } } } } return false; }
/** * Check that an Element is signed or encrypted by one of the token results */ private boolean checkProtectionResult( Element elementToProtect, boolean content, List<WSSecurityEngineResult> protResults, List<WSSecurityEngineResult> tokenResults ) { elementToProtect = (Element)DOMUtils.getDomElement(elementToProtect); for (WSSecurityEngineResult result : protResults) { List<WSDataRef> dataRefs = CastUtils.cast((List<?>)result.get(WSSecurityEngineResult.TAG_DATA_REF_URIS)); if (dataRefs != null) { for (WSDataRef dataRef : dataRefs) { if (elementToProtect == dataRef.getProtectedElement() && content == dataRef.isContent() && checkSignatureOrEncryptionResult(result, tokenResults)) { return true; } } } } return false; }