if(st.getSignedElements().hasNext() || st.getSignedParts().hasNext()){
buildSP = true;
}
while(tokens.hasNext()){
Token token = (Token) tokens.next();
SecurityPolicyVersion spVersion = SecurityPolicyUtil.getSPVersion((PolicyAssertion)token);
WSSPolicy policy = tokenProcessor.getWSSToken(token);
if (this instanceof EndorsingSupportingTokensProcessor) {
if (PolicyUtil.isUsernameToken((PolicyAssertion)token,spVersion)) {
AuthenticationTokenPolicy.UsernameTokenBinding utb =
(AuthenticationTokenPolicy.UsernameTokenBinding) policy;
utb.isEndorsing(true);
}
}
if(PolicyUtil.isIssuedToken((PolicyAssertion) token, spVersion) &&
this instanceof EndorsingSupportingTokensProcessor){
((IssuedTokenKeyBinding)policy).setSTRID(null);
}
if ( policy.getUUID() != null ) {
addToPrimarySignature(policy,token);
encryptToken(token, spVersion);
if(PolicyUtil.isSamlToken((PolicyAssertion)token, spVersion)){
correctSAMLBinding(policy);
}
collectSignaturePolicies(token);
if(buildEP){
EncryptionPolicy ep = new EncryptionPolicy();
ep.setKeyBinding(policy);
getEPList().add(ep);
}
}
//TODO:: Add token to MessagePolicy;
if (!(this instanceof EndorsingSupportingTokensProcessor) ||
(this instanceof EndorsingSupportingTokensProcessor && token instanceof X509Token && token.getIncludeToken().endsWith("Never"))) {
AuthenticationTokenPolicy atp = new AuthenticationTokenPolicy();
atp.setFeatureBinding(policy);
policyContainer.insert(atp);
}
//TODO: Take care of targets.