* Process Supporting tokens
*/
if(rmd.isInitiator()) {
Vector signatureValues = new Vector();
SupportingToken sgndSuppTokens = rpd.getSignedSupportingTokens();
if(sgndSuppTokens != null && sgndSuppTokens.getTokens() != null &&
sgndSuppTokens.getTokens().size() > 0) {
log.debug("Processing signed supporting tokens");
ArrayList tokens = sgndSuppTokens.getTokens();
for (Iterator iter = tokens.iterator(); iter.hasNext();) {
Token token = (Token) iter.next();
if(token instanceof UsernameToken) {
WSSecUsernameToken utBuilder = addUsernameToken(rmd,(UsernameToken)token);
utBuilder.prepare(rmd.getDocument());
//Add the UT
utBuilder.appendToHeader(rmd.getSecHeader());
} else {
throw new RampartException("unsupportedSignedSupportingToken",
new String[]{"{" +token.getName().getNamespaceURI()
+ "}" + token.getName().getLocalPart()});
}
}
}
SupportingToken sgndEndSuppTokens = rpd.getSignedEndorsingSupportingTokens();
if(sgndEndSuppTokens != null && sgndEndSuppTokens.getTokens() != null &&
sgndEndSuppTokens.getTokens().size() > 0) {
log.debug("Processing endorsing signed supporting tokens");
ArrayList tokens = sgndEndSuppTokens.getTokens();
SignedEncryptedParts signdParts = sgndEndSuppTokens.getSignedParts();
for (Iterator iter = tokens.iterator(); iter.hasNext();) {
Token token = (Token) iter.next();
if(token instanceof IssuedToken && rmd.isInitiator()) {
signatureValues.add(doIssuedTokenSignature(rmd, token, signdParts));
} else if(token instanceof X509Token) {
signatureValues.add(doX509TokenSignature(rmd, token, signdParts));
}
}
}
SupportingToken endSupptokens = rpd.getEndorsingSupportingTokens();
if(endSupptokens != null && endSupptokens.getTokens() != null &&
endSupptokens.getTokens().size() > 0) {
log.debug("Processing endorsing supporting tokens");
ArrayList tokens = endSupptokens.getTokens();
SignedEncryptedParts signdParts = endSupptokens.getSignedParts();
for (Iterator iter = tokens.iterator(); iter.hasNext();) {
Token token = (Token) iter.next();
if(token instanceof IssuedToken && rmd.isInitiator()){
signatureValues.add(doIssuedTokenSignature(rmd, token, signdParts));
} else if(token instanceof X509Token) {
signatureValues.add(doX509TokenSignature(rmd, token, signdParts));
} else if (token instanceof SecureConversationToken) {
handleSecureConversationTokens(rmd, (SecureConversationToken)token);
signatureValues.add(doSecureConversationSignature(rmd, token, signdParts));
}
}
}
SupportingToken supportingToks = rpd.getSupportingTokens();
this.handleSupportingTokens(rmd, supportingToks);
//Store the signature values vector
rmd.getMsgContext().setProperty(WSHandlerConstants.SEND_SIGV, signatureValues);