return null;
}
Vector results = null;
WSSecurityEngine engine = new WSSecurityEngine();
ValidatorData data = new ValidatorData(rmd);
SOAPHeader header = rmd.getMsgContext().getEnvelope().getHeader();
if (header == null) {
throw new RampartException("missingSOAPHeader");
}
ArrayList headerBlocks = header.getHeaderBlocksWithNSURI(WSConstants.WSSE_NS);
SOAPHeaderBlock secHeader = null;
// Issue is axiom - a returned collection must not be null
if (headerBlocks != null) {
Iterator headerBlocksIterator = headerBlocks.iterator();
while (headerBlocksIterator.hasNext()) {
SOAPHeaderBlock elem = (SOAPHeaderBlock) headerBlocksIterator.next();
if (elem.getLocalName().equals(WSConstants.WSSE_LN)) {
secHeader = elem;
break;
}
}
}
if (secHeader == null) {
throw new RampartException("missingSecurityHeader");
}
long t0 = 0, t1 = 0, t2 = 0, t3 = 0;
if (dotDebug) {
t0 = System.currentTimeMillis();
}
String actorValue = secHeader.getAttributeValue(new QName(rmd.getSoapConstants()
.getEnvelopeURI(), "actor"));
Crypto signatureCrypto = RampartUtil.getSignatureCrypto(rpd.getRampartConfig(), msgCtx
.getAxisService().getClassLoader());
TokenCallbackHandler tokenCallbackHandler = null;
if (rpd != null) {
tokenCallbackHandler = new TokenCallbackHandler(rmd.getTokenStorage(),
RampartUtil.getPasswordCB(rmd), rpd.getRampartConfig());
} else {
tokenCallbackHandler = new TokenCallbackHandler(rmd.getTokenStorage(),
RampartUtil.getPasswordCB(rmd));
}
if (rpd.isSymmetricBinding()) {
// Here we have to create the CB handler to get the tokens from the
// token storage
log.debug("Processing security header using SymetricBinding");
results = engine.processSecurityHeader(rmd.getDocument(), actorValue,
tokenCallbackHandler, signatureCrypto, RampartUtil.getEncryptionCrypto(
rpd.getRampartConfig(), msgCtx.getAxisService().getClassLoader()));
// Remove encryption tokens if this is the initiator and if initiator is receiving a
// message
if (rmd.isInitiator()
&& (msgCtx.getFLOW() == MessageContext.IN_FLOW || msgCtx.getFLOW() == MessageContext.IN_FAULT_FLOW)) {
tokenCallbackHandler.removeEncryptedToken();
}
} else {
log.debug("Processing security header in normal path");
results = engine.processSecurityHeader(rmd.getDocument(), actorValue,
tokenCallbackHandler, signatureCrypto, RampartUtil.getEncryptionCrypto(
rpd.getRampartConfig(), msgCtx.getAxisService().getClassLoader()));
}
if (dotDebug) {