A way to set WSTrustChannelSecurityTokenProvider.ClientCredentials
The WsTrustRequest object and its serializer has supports for many request elements that I need, but the WSTrustChannelSecurityTokenProvider provider does not have many of them set. Thus, I need to customize content of the WsTrustRequest object and the only way to do that is to derive from the WSTrustChannelSecurityTokenProvider and override the CreateWsTrustRequest method:
The next step is to make a new implement of the ClientCredentialsSecurityTokenManager (similar to WSTrustChannelSecurityTokenManager) which can return my new SecurityTokenProvider:
Related code of the built-in WSTrustChannelSecurityTokenManager class:
But there is a big problem here: in my custom code, I cannot set the ClientCredentials property because it is an internal one.
I would argue not allowing user code to set the ClientCredentials property is a big usability design problem. This means that any use cases that need ClientCredentials simply cannot work. This leaves me with 2 equally ugly paths: either use reflection to set ClientCredentials or clone the whole code of the WSTrustChannelSecurityTokenProvider to my custom provider.
Is there a better approach? Otherwise, I would like to request for a way to set the ClientCredentials object.
Thank you for reading, Thuan.