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

  • Home
  • SEARCH
  • 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 7417347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:41:01+00:00 2026-05-29T07:41:01+00:00

I am using ADFS 2.0 for quite some time and I understand how things

  • 0

I am using ADFS 2.0 for quite some time and I understand how things work. I’ve done dozen of custom RPs, custom STSes as well as using the ADFS as the relying STS.

However, I have a simple requirement which I still fail to fulfill.

I want my users to be forced to relogin after some fixed time. Let’s say 1 minute, for test purposes.

First, I’ve made some corrections at the RPs side. It seems that for unknown reason, the RP retains the session even if the token’s validTo points back in time. This contradicts what Vittorio Bertocci says in his book (page 123) where he shows how to perform sliding expiration – he says that “The SessionAuthenticationModule will take care of handling the expired session right after”. Well, for me it doesn’t, however I have found a trick here http://blogs.planbsoftware.co.nz/?p=521 – take a look at the “if” clause:

        sam.SessionSecurityTokenReceived +=
            ( s, e ) =>
            {
                SessionAuthenticationModule _sam = s as SessionAuthenticationModule;

                DateTime now = DateTime.UtcNow;

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

                try
                {
                    double halfSpan = ( validTo - validFrom ).TotalSeconds / 2;
                    if ( validTo < now )
                    {
                        _sam.DeleteSessionTokenCookie();
                        e.Cancel = true;
                    }
                }
                catch ( Exception ex )
                {
                    int v = 0;
                }
            };

This trick fixes the issue at the RPs side. When the token is invalid the application clears it out and redirects to the login page.

Now comes the problem. My login page uses the FederatedPassiveSignIn control. When clicked, it redirects the browser to the ADFS.

But ADFS happily creates a new session without any prompt for the user.

I have set the token’s lifetime for this RP to 1:

Set-ADFSRelyingPartyTrust -Targetname "myrpname" -TokenLifetime 1

and using Get-ADFSRelyingPartyTrust I can see that it’s set to 1 (I even print the token validTo on my page to confirm that this is set correctly).

Then I set ADFS properties with ADFS-SetProperties:

ADFS-SetProperties -SsoLifetime 1
ADFS-SetProperties -ReplyCacheExpirationInterval 1
ADFS-SetProperties -SamlMessageDeliveryWindow 1

but still no luck. I am stuck now.

The scenario works correctly with my custom STS where the validity of the STS session is based on a Forms cookie – if I set the STS’s forms cookie timeout to 1, after 1 minute of inactivity within my RP application I am redirected to the login page of my RP which then redirects to the STS which presents its login page.

However, this is not the case with ADFS 2.0. After a minute of inactivity, I am redirected to the login page of my RP which redirects to ADFS’s login page which in turn redirects back happily just like the session would be still active within ADFS.

I would like someone to:

(1) take a look at the hack described at the top and explain why an expired token is not automatically rejected and such ugly hack is needed

(2) explain how to properly timeout the session at the ADFS 2.0 side so a request to renew the token is guarded with a login page.

Thanks in advance.

edit

I can confirm that setting all above parameters to 1 minute makes the ADFS session invalid after 5 minutes (or more). That’s strage and it seems that either I am making a basic mistake or 5 minutes is the minumum acceptable value.

My (2) from above is now then just to confirm and explain my observation.

  • 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-05-29T07:41:02+00:00Added an answer on May 29, 2026 at 7:41 am

    As per comments above (joint effort with the OP) the Freshness property on the FederatedPassiveSignIn instance should be set to 0.

    According to http://docs.oasis-open.org/wsfed/federation/v1.2/ws-federation.html this indicates for the IP/STS to re-prompt the user for authentication before it issues the token.

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

Sidebar

Related Questions

Using C# .NET 3.5 and WCF, I'm trying to write out some of the
I am currently using ADFS authentication mechanism to authenticate the user. In that case
I get a number of browser error messages using ADFS, all of the form.
I am very very new to ADFS 2.0, i have been using Domain trust
Suppose you have to implement Graph class, containing some algorithms, using dfs (depth-first search).
Using Django, how do I generate the value of a field the first time
We have an ADFS 2.0 installation that's working well for our MVC apps in
Using of mobile dialog authentication is working well for other mobile devices except on
We are using CRM 2011 w/ ADFS 2.0. Our users would like for one
Using online interfaces to a version control system is a nice way to have

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.