PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
TimestampSecurityEvent timestampSecurityEvent = new TimestampSecurityEvent();
policyEnforcer.registerSecurityEvent(timestampSecurityEvent);
SecurityContextTokenSecurityEvent initiatorTokenSecurityEvent = new SecurityContextTokenSecurityEvent();
SecureConversationSecurityTokenImpl securityToken =
new SecureConversationSecurityTokenImpl(
null, "1", WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
initiatorTokenSecurityEvent.setSecurityToken(securityToken);
policyEnforcer.registerSecurityEvent(initiatorTokenSecurityEvent);
SecurityContextTokenSecurityEvent recipientTokenSecurityEvent = new SecurityContextTokenSecurityEvent();
securityToken = new SecureConversationSecurityTokenImpl(
null, "1", WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainEncryption);
recipientTokenSecurityEvent.setSecurityToken(securityToken);
policyEnforcer.registerSecurityEvent(recipientTokenSecurityEvent);
List<XMLSecurityConstants.ContentType> protectionOrder = new LinkedList<XMLSecurityConstants.ContentType>();
protectionOrder.add(XMLSecurityConstants.ContentType.SIGNATURE);