Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8601791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:55:33+00:00 2026-06-12T01:55:33+00:00

We’re using the Windows Identity Foundation to implement a Single Sign-On solution for our

  • 0

We’re using the Windows Identity Foundation to implement a Single Sign-On solution for our application. The problem I’m encountering is that the FedAuth cookie isn’t expiring when I think it should on the Relying Party side.

The FedAuth cookie isn’t being destroying until approximately five minutes after its ValidTo time. For testing purposes I have the token lifetime and session set to timeout after ten minutes.

<sessionState timeout="10" mode="SQLServer" sqlConnectionString="..." />

<securityTokenHandlers>
  <add type="Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
    <sessionTokenRequirement lifetime="00:10" />
  </add>
</securityTokenHandlers>  

We’ve implemented our own SessionAuthenticationModule because we’re using sliding sessions. The code was taken pretty much verbatim from Programming Windows Identity Foundation but I don’t think that’s the problem as I’ve tried commenting out the code in the SessionSecurityTokenReceived event and I’m seeing the same behavior, but just for completeness.

DateTime now = DateTime.UtcNow;
DateTime validFrom = e.SessionToken.ValidFrom;
DateTime validTo = e.SessionToken.ValidTo;

double tokenLifetime = (validTo - validFrom).TotalMinutes;

if( now < validTo && now > validFrom.AddMinutes( tokenLifetime / 2 ) )
{
    SessionAuthenticationModule sam = sender as SessionAuthenticationModule;
    e.SessionToken = sam.CreateSessionSecurityToken(
        e.SessionToken.ClaimsPrincipal, e.SessionToken.Context,
        now, now.AddMinutes( tokenLifetime ), e.SessionToken.IsPersistent );
    e.ReissueCookie = true;
}

If I sign into the app at 10:00am while debug the above code I can see the validTo value is 10:10am. I then let the app sit for eleven minutes and click on another link. In debugging the above I see that the value of now (10:11am) is indeed > validTo (10:10am) so the token expiration is not updated. At this point I would expect the SAM to destroy the FedAuth cookie. However, the FedAuth cookie is not destroyed, the value of Request.IsAuthenticated is still true (due to the presence of the cookie I’m assuming) and the user continues to access the application. It isn’t until ~10:15am when I actually see the cookie being expired (using Fiddler).

I’m at a loss as to why the FedAuth cookie isn’t being destroyed on the first access after the validTo time has expired. I can fudge it by setting my expiration times to be five minutes less than what I really want them to be, but I’d prefer to understand why I’m seeing this behavior.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T01:55:35+00:00Added an answer on June 12, 2026 at 1:55 am

    This happens because there is a clock skew which by default I is set to 5 minutes. Typically clock skew is used to mitigate clock synchronization among servers (in this case servers of the same farm). If you want to disable or decrease that value you can do it by setting (from the top of my head)

    FederatedAuthentication.ServiceConfiuration.MaxClockSkew = TimeSpan.FromSeconds(10);

    Just make sure that server clocks are 100% synchronized

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm trying to create an if statement in PHP that prevents a single post
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.