I wish to correlate all the calls throughout Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectEvents (OnRedirectToIdentityProvider, OnAuthorizationCodeReceived etc).
I wish to set the 'state' parameter in OnRedirectToIdentityProvider as a GUID to later corralate the calls in logs, for example
OnRedirectToIdentityProvider = async context =>
{
var myGuid = Guid.NewGuid().ToString();
context.ProtocolMessage.State = myGuid;
_log.LogInformation("OnRedirectToIdentityProvider: {0}", myGuid);
...
},
OnAuthorizationCodeReceived = async context =>
{
_log.LogInformation("OnAuthorizationCodeReceived: {0}", context.ProtocolMessage.State);
...
},
...
In the docs it is said that identityserver will echo back the state value on the token response. http://docs.identityserver.io/en/latest/endpoints/authorize.html
I also read that client is responsible for the validation of this property.
The question is:
I couldn't find any specific resource about when I want to use 'state' property, whether the validation is handled automatically by the middleware or should I handle the validation myself in a callback function?
Is there any security risks I should consider when using GUID in a 'state' parameter?
Pros/cons I should consider?
Regards, A