Search code examples
samlitfoxtec-identity-saml2

ITfoxtec SAML 2.0 Session TimeOut


Am using SAML2.0 AUTH with help of ITfoxtec.Identity.Saml2.Mvc package but I need to increase the session timeout to a 2 to 3 days . But currently default value there . How We can override the session time out . With .net core 3.1


Solution

  • You can set a custom session timeout in the AssertionConsumerService method in the Auth Controller. Se documentation.

    Set session timeout to 2 days:

    await saml2AuthnResponse.CreateSession(HttpContext, 
      lifetime: new TimeSpan(2, 0,0,0), 
      claimsTransform: (claimsPrincipal) => ClaimsTransform.Transform(claimsPrincipal));
    

    It is also possible to configure the session as persistence:

    await saml2AuthnResponse.CreateSession(HttpContext, 
      lifetime: new TimeSpan(2, 0,0,0), isPersistent: true, 
      claimsTransform: (claimsPrincipal) => ClaimsTransform.Transform(claimsPrincipal));