locked
ADFS Sliding Expiration RRS feed

All replies

  • Still hoping for a reply on this.  I tried doing this in the global.asax in the CRMWeb folder but it had no effect.

    <%@ Application language="c#" Inherits="Microsoft.Crm.MainApplication" CodeBehind="Microsoft.Crm.Application.Pages.dll"%>
    <%@ Import Namespace="Microsoft.IdentityModel.Web" %>
    <%@ Import Namespace="Microsoft.IdentityModel.Tokens" %>
    <script runat="server">
      void SessionAuthenticationModule_SessionSecurityTokenReceived
           (object sender, SessionSecurityTokenReceivedEventArgs e)
      {
        DateTime now = DateTime.UtcNow;
        DateTime validFrom = e.SessionToken.ValidFrom;
        DateTime validTo = e.SessionToken.ValidTo;
        double halfSpan = (validTo - validFrom).TotalMinutes / 2;
        if ( validFrom.AddMinutes( halfSpan ) < now && now < validTo )
        {
          SessionAuthenticationModule sam = sender as SessionAuthenticationModule;
          e.SessionToken = sam.CreateSessionSecurityToken(e.SessionToken.ClaimsPrincipal,
             e.SessionToken.Context, now, now.AddMinutes(2), e.SessionToken.IsPersistent);
          e.ReissueCookie = true;
        }
      }
    </script>


    Tim

    Monday, March 24, 2014 11:39 PM