Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetTokenCore attempts to close a faulted channel #5648

Open
cjberg opened this issue Sep 17, 2024 · 0 comments
Open

GetTokenCore attempts to close a faulted channel #5648

cjberg opened this issue Sep 17, 2024 · 0 comments
Assignees
Labels

Comments

@cjberg
Copy link

cjberg commented Sep 17, 2024

Describe the bug
I experimented with using WSTrustChannelSecurityTokenProvider to issue a token via WS-Trust, much like described in #4542. Then I ran into a problem when the STS responded with a SOAP Fault, which contained information that the code needed to act on.

The problem is that GetTokenCore uses try..finally to always call channel.Close() (source code), but if the channel has entered a faulted state it results in CommunicationObjectFaultedException, which in turn hides the SOAP Fault exception that had been thrown.

I believe the code in the finally block should examine the state of the channel and instead call Abort() in a faulted state.

It was just an experiment and I ended up using WSTrustChannelFactory instead for this, but I still want to report it, as it could hide valuable exception information in a normal WsFederationHttpBinding use case.

To Reproduce
Steps to reproduce the behavior:

  1. Attempt to request a security token with similar code as found in UserName Endpoint STS #4542.
  2. Make sure the STS responds with a SOAP Fault.

Expected behavior
The SOAP Fault exception should not be hidden by a CommunicationObjectFaultedException.

Additional context
This was tested with .NET 8 and System.ServiceModel.Federation version 8.0.0.

@HongGit HongGit assigned imcarolwang and mconnew and unassigned imcarolwang Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants