Open Engineerumair opened 5 years ago
I have captured the event but I need to store the claims into cookie, can you please let me know how to store it
Here is my code
options.Events = new OpenIdConnectEvents() { OnUserInformationReceived = async n => {
// Exchange code for access and ID tokens
CookieOptions cookies = new CookieOptions();
cookies.Expires = DateTime.Now.AddDays(1);
cookies.IsEssential = true;
KeyValuePair<string, string> valuePair;
// write out the user claims
foreach (var claim in n.Principal.Claims)
{
if (claim.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress")
{
valuePair = new KeyValuePair<string, string>("emailaddress", claim.Value);
n.HttpContext.Request.Cookies.Append(valuePair);
}
else if (claim.Type == "name")
{
valuePair = new KeyValuePair<string, string>(claim.Type, claim.Value);
n.HttpContext.Request.Cookies.Append(valuePair);
}
}
}
};
});
@Engineerumair slow to answer.. sorry.
Have you solved this?
Greetings Damien
Sorry, I was not able to store it
I need to capture event after successful authentication and store the claims into cookie, can you please guide on this