bstPath.add(WSSConstants.TAG_wsse_BinarySecurityToken);
XMLSecEvent recipientTokenXmlEvent = XMLSecEventFactory.createXmlSecStartElement(WSSConstants.TAG_wsse_UsernameToken, null, null);
X509TokenSecurityEvent recipientX509TokenSecurityEvent = new X509TokenSecurityEvent();
X509SecurityTokenImpl recipientToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
recipientX509TokenSecurityEvent.setSecurityToken(recipientToken);
recipientToken.setElementPath(bstPath);
recipientToken.setXMLSecEvent(recipientTokenXmlEvent);
recipientToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_Encryption);
inboundWSSecurityContext.registerSecurityEvent(recipientX509TokenSecurityEvent);
List<XMLSecurityConstants.ContentType> protectionOrder = new LinkedList<XMLSecurityConstants.ContentType>();
protectionOrder.add(XMLSecurityConstants.ContentType.ENCRYPTION);
protectionOrder.add(XMLSecurityConstants.ContentType.SIGNATURE);
List<QName> signaturePath = new LinkedList<QName>();
signaturePath.addAll(WSSConstants.WSSE_SECURITY_HEADER_PATH);
signaturePath.add(WSSConstants.TAG_dsig_Signature);
EncryptedElementSecurityEvent signatureEncryptedElementSecurityEvent = new EncryptedElementSecurityEvent(recipientToken, true, protectionOrder);
signatureEncryptedElementSecurityEvent.setElementPath(signaturePath);
inboundWSSecurityContext.registerSecurityEvent(signatureEncryptedElementSecurityEvent);
List<QName> usernameTokenPath = new LinkedList<QName>();
usernameTokenPath.addAll(WSSConstants.WSSE_SECURITY_HEADER_PATH);
usernameTokenPath.add(WSSConstants.TAG_wsse_UsernameToken);
XMLSecEvent usernameTokenXmlEvent = XMLSecEventFactory.createXmlSecStartElement(WSSConstants.TAG_wsse_UsernameToken, null, null);
EncryptedElementSecurityEvent usernameEncryptedElementSecurityEvent = new EncryptedElementSecurityEvent(recipientToken, true, protectionOrder);
usernameEncryptedElementSecurityEvent.setElementPath(usernameTokenPath);
usernameEncryptedElementSecurityEvent.setXmlSecEvent(usernameTokenXmlEvent);
inboundWSSecurityContext.registerSecurityEvent(usernameEncryptedElementSecurityEvent);
XMLSecEvent signedEndorsingEncryptedTokenXmlEvent = XMLSecEventFactory.createXmlSecStartElement(WSSConstants.TAG_wsse_UsernameToken, null, null);
EncryptedElementSecurityEvent signedEndorsedEncryptedTokenEncryptedElementSecurityEvent = new EncryptedElementSecurityEvent(recipientToken, true, protectionOrder);
signedEndorsedEncryptedTokenEncryptedElementSecurityEvent.setElementPath(bstPath);
signedEndorsedEncryptedTokenEncryptedElementSecurityEvent.setXmlSecEvent(signedEndorsingEncryptedTokenXmlEvent);
inboundWSSecurityContext.registerSecurityEvent(signedEndorsedEncryptedTokenEncryptedElementSecurityEvent);
XMLSecEvent encryptedSupportingTokenXmlEvent = XMLSecEventFactory.createXmlSecStartElement(WSSConstants.TAG_wsse_UsernameToken, null, null);
EncryptedElementSecurityEvent encryptedSupportingTokenEncryptedElementSecurityEvent = new EncryptedElementSecurityEvent(recipientToken, true, protectionOrder);
encryptedSupportingTokenEncryptedElementSecurityEvent.setElementPath(bstPath);
encryptedSupportingTokenEncryptedElementSecurityEvent.setXmlSecEvent(encryptedSupportingTokenXmlEvent);
inboundWSSecurityContext.registerSecurityEvent(encryptedSupportingTokenEncryptedElementSecurityEvent);
UsernameTokenSecurityEvent usernameTokenSecurityEvent = new UsernameTokenSecurityEvent();
UsernameSecurityTokenImpl usernameSecurityToken = new UsernameSecurityTokenImpl(
WSSConstants.UsernameTokenPasswordType.PASSWORD_TEXT,
"username", "password", new Date().toString(), null, new byte[10], 10L,
null, IDGenerator.generateID(null), WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
usernameSecurityToken.setElementPath(usernameTokenPath);
usernameSecurityToken.setXMLSecEvent(usernameTokenXmlEvent);
usernameTokenSecurityEvent.setSecurityToken(usernameSecurityToken);
inboundWSSecurityContext.registerSecurityEvent(usernameTokenSecurityEvent);
XMLSecEvent signedEndorsingTokenXmlEvent = XMLSecEventFactory.createXmlSecStartElement(WSSConstants.TAG_wsse_UsernameToken, null, null);
X509TokenSecurityEvent signedEndorsingSupporting509TokenSecurityEvent = new X509TokenSecurityEvent();
X509SecurityTokenImpl signedEndorsingSupportingToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
signedEndorsingSupporting509TokenSecurityEvent.setSecurityToken(signedEndorsingSupportingToken);
signedEndorsingSupportingToken.setElementPath(bstPath);
signedEndorsingSupportingToken.setXMLSecEvent(signedEndorsingTokenXmlEvent);
inboundWSSecurityContext.registerSecurityEvent(signedEndorsingSupporting509TokenSecurityEvent);
X509TokenSecurityEvent encryptedSupporting509TokenSecurityEvent = new X509TokenSecurityEvent();
X509SecurityTokenImpl encryptedSupportingToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
encryptedSupporting509TokenSecurityEvent.setSecurityToken(encryptedSupportingToken);
encryptedSupportingToken.setElementPath(bstPath);
encryptedSupportingToken.setXMLSecEvent(encryptedSupportingTokenXmlEvent);
inboundWSSecurityContext.registerSecurityEvent(encryptedSupporting509TokenSecurityEvent);
X509TokenSecurityEvent supporting509TokenSecurityEvent = new X509TokenSecurityEvent();
X509SecurityTokenImpl supportingToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
supporting509TokenSecurityEvent.setSecurityToken(supportingToken);
supportingToken.setElementPath(bstPath);
inboundWSSecurityContext.registerSecurityEvent(supporting509TokenSecurityEvent);
X509TokenSecurityEvent signedEndorsingEncryptedSupporting509TokenSecurityEvent = new X509TokenSecurityEvent();
X509SecurityTokenImpl signedEndorsingEncryptedSupportingToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
signedEndorsingEncryptedSupporting509TokenSecurityEvent.setSecurityToken(signedEndorsingEncryptedSupportingToken);
signedEndorsingEncryptedSupportingToken.setElementPath(bstPath);
signedEndorsingEncryptedSupportingToken.setXMLSecEvent(signedEndorsingEncryptedTokenXmlEvent);
inboundWSSecurityContext.registerSecurityEvent(signedEndorsingEncryptedSupporting509TokenSecurityEvent);
XMLSecEvent initiatorTokenXmlEvent = XMLSecEventFactory.createXmlSecStartElement(WSSConstants.TAG_wsse_UsernameToken, null, null);
X509TokenSecurityEvent initiator509TokenSecurityEvent = new X509TokenSecurityEvent();
X509SecurityTokenImpl initiatorToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
initiator509TokenSecurityEvent.setSecurityToken(initiatorToken);
initiatorToken.setElementPath(bstPath);
initiatorToken.setXMLSecEvent(initiatorTokenXmlEvent);
inboundWSSecurityContext.registerSecurityEvent(initiator509TokenSecurityEvent);
initiator509TokenSecurityEvent = new X509TokenSecurityEvent();
initiator509TokenSecurityEvent.setSecurityToken(initiatorToken);
initiatorToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_Signature);
inboundWSSecurityContext.registerSecurityEvent(initiator509TokenSecurityEvent);
SignatureValueSecurityEvent signatureValueSecurityEvent = new SignatureValueSecurityEvent();
inboundWSSecurityContext.registerSecurityEvent(signatureValueSecurityEvent);