[5.0] Claims authentification FedAuth cookie not fill after AuthenticateUser
Hello,
I use this method SecurityManager.AuthenticateUser(...) to login automatically a user.
The user is logged but the cookies FedAuth isn't generate. Why?
If I refresh the page this user isn't more logged.
Thanks for your help
I post this thread like a issue.
And here my tips to around this problem:
1.
IClaimsPrincipal claimsPrincipal = ClaimsManager.GetCurrentPrincipal();
2.
IClaimsIdentity claimsIdentity = (IClaimsIdentity)claimsPrincipal.Identity;
3.
4.
var token = FederatedAuthentication.SessionAuthenticationModule.CreateSessionSecurityToken(claimsPrincipal,
"FedAuth"
, DateTime.UtcNow, DateTime.UtcNow.AddMinutes(20),
true
);
5.
6.
token.IsSessionMode =
true
;
7.
8.
FederatedAuthentication.SessionAuthenticationModule.WriteSessionTokenToCookie(token);
Thank you so much for posting your code. I was struggling with this today while trying to create a custom login control.
While this worked for the local site it does not work for Single Sign On (SSO). Any thoughts on what you'd have to do? I presume you'd need to mess with the Simple Web Token SWT functions? I'm new to claims and have no clue.