More in this section

Forums / Developing with Sitefinity / [5.0] Claims authentification FedAuth cookie not fill after AuthenticateUser

[5.0] Claims authentification FedAuth cookie not fill after AuthenticateUser

4 posts, 0 answered
  1. mstoffel
    mstoffel avatar
    27 posts
    Registered:
    13 Jul 2005
    12 Apr 2012
    Link to this post
    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
  2. mstoffel
    mstoffel avatar
    27 posts
    Registered:
    13 Jul 2005
    13 Apr 2012
    Link to this post
    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);
  3. cli
    cli avatar
    50 posts
    Registered:
    21 May 2007
    17 May 2012
    Link to this post
    Thank you so much for posting your code.  I was struggling with this today while trying to create a custom login control.
  4. cli
    cli avatar
    50 posts
    Registered:
    21 May 2007
    17 May 2012
    Link to this post
    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.
4 posts, 0 answered