The STS creates encrypted responses by wrapping the output of Saml11/Saml2SecurityTokenHandler.WriteToken in EncryptedSecurityToken.WriteToken. In both handlers, the serialization takes place in WriteAssertion.
You can derive your own Saml handler from one or both of these and override the WriteAssertion method to serialize a second time to your log file. This has performance implications, but I assume your interest here is for debugging.
If you aren't interested in the actual XML, you could also override WriteToken and capture whatever you want from the binary token. |