private boolean signsItsSignatureToken(SecurityToken securityToken) throws XMLSecurityException {
for (int i = 0; i < signedElementEvents.size(); i++) {
SignedElementSecurityEvent signedElementSecurityEvent = signedElementEvents.get(i);
if (WSSUtils.pathMatches(signedElementSecurityEvent.getElementPath(), ((InboundSecurityToken)securityToken).getElementPath(), false, false)) {
SecurityToken signingSecurityToken = signedElementSecurityEvent.getSecurityToken();
signingSecurityToken = getEffectiveSignatureToken(signingSecurityToken);
if (signingSecurityToken.getId().equals(securityToken.getId())) {
//ok we've found the correlating signedElementSecurityEvent. Now we have to find the Token that
//is covered by this signedElementSecurityEvent:
for (int j = 0; j < tokenSecurityEvents.size(); j++) {
TokenSecurityEvent<? extends SecurityToken> tokenSecurityEvent = tokenSecurityEvents.get(j);
SecurityToken st = getEffectiveSignatureToken(tokenSecurityEvent.getSecurityToken());
if (signedElementSecurityEvent.getXmlSecEvent() == ((InboundSecurityToken)st).getXMLSecEvent()) {
//...and we got the covered token
//next we have to see if the token is the same:
if (st.getId().equals(securityToken.getId())) { //NOPMD
return true;
}
}
}
}