Closed rick-micpoint closed 1 month ago
The changes to the authorize URL are happening because IdentityServer supports pushed authorization. The idea is that instead of putting parameters into the front channel, they are moved to a backchannel (direct server to server) call, and then in the front channel you just refer to those pushed parameters by identifier (the request uri). In IdentityServer 7, we added support for PAR, and OidcClient will see that in the discovery doc and by default try to use it.
You might be able to work around this by disabling PAR in the OidcClient options, but it would be better for us to figure out why pushed state is getting mucked up - both because if there is a bug I would like to fix it and because it would allow you to use a good security feature. Ultimately this could be a serialization issue in any of:
So, 2 questions:
Disabling PAR indeed "fixes" the problem. This is done by setting DisablePushedAuthorization
to true
in the OidcClientOptions
. We sadly do not have the capacity right now to dive deeper into the issue and find the actual culprit.
Ok. I'll close the issue for now. Should you have anything to add in the future please reopen.
Which version of Duende IdentityServer are you using? We switched from 6.0.0 to 7.0.6
Which version of .NET are you using? .NET 8.0
Describe the bug
We use
OidcClient
together withWinUIEx.WebAuthenticator
to authenticate on Windows from our .NET MAUI app. This worked fine, until we upgraded IdentityServer from 6.0.0 to 7.0.6. The callback URL no longer seemed to work properly, and every login attempt caused a new instance of the application to open.Diving deeper, it looks like
WinUIEx.WebAuthenticator
uses thestate
query parameters to identify if the callback is meant for a specific instance of the app. The query parameters seem to have changed however from 6.0.0 to 7.0.6. In 6.0.0state
is in the authorize URL, and has a JSONobject as its value in the callback URL. In 7.0.6, thestate
query parameter is no longer in the authorize URL, and while it exists in the callback URL, the data it contains is no longer JSON.WinUIEx.WebAuthenticator
expect JSON, but it's no longer there, so it can no longer validate if the callback is meant for this app instance.To Reproduce
OidcClient
with the basic properties, e.g.:OidcClient.LoginAsync()
BrowserOptions.StartUrl
will contain the following query parametersresponse_type
state
code_challenge
code_challenge_method
client_id
scope
redirect_uri
BrowserOptions.StartUrl
will contain the following query parametersclient_id
request_uri
state
contains JSON data.state
contains non JSON data.Expected behavior
Everything expects the
state
parameter to contain JSON. If I need to set something explicitly that is fine, but we need to have the same behaviour back.Log output/exception with stacktrace
6.0.0 authorize URL
6.0.0 callback URL state
As JSON
7.0.6 authorize URL
7.0.6 callback URL state