question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OpenIdConnect terminates the session in 5 minutes

See original GitHub issue

We have ASP.NET app hosted in Azure, using CookieAuthentication. When user logs in, session stays valid (possibly hours or days, we haven’t measured exactly).

When we add OpenIdConnectAuthentication, the session gets terminated after 5 minutes of inactivity.

It is not necessary to use that OpenIdConnect to login. Even if user has used cookie based login, after 5 minutes of inactivity, the next request gets redirected to RedirectToIdentityProvider notification handler of OpenIdConnect, but at that time, the user session is already gone.

ASP.NET is using version 4.8, Owin libraries have version 4.2.2.

Is there any settings, which would make that session to last longer? Or settings, where OpenIdConnect would not interfere at all with sessions, it does not own?

Issue Analytics

  • State:closed
  • Created 8 months ago
  • Comments:21 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
tomburgercommented, Feb 26, 2023

Hi @Tratcher ,

sorry for the delay, but I have now isolated repro for you on following repository: https://github.com/tomburger/aspnet-auth-sample

Just clone it, open solution in src folder and run it in Visual Studio. It has a login screen and there are four users available, ringo@beat.les, john@…, paul@… and george@…, password “LetItBe” for all four of them. After login there are two pages and you can navigate between them with button. If you wait for 5 minutes and then you click the button, you will be logged out and redirected back to login screen.

If you go to file src\App_Start\Startup.Auth.cs and comment out OIDC part (lines 25-79), then logout after 5 minutes is not happening.

Please, notice that you are still using cookie authentication, the difference is only the call to UseOpenIdConnectAuthentication. If you call it, your session is terminated after 5 minutes, if you do not call it, it will stay valid much longer.

Feel free to ask more questions, or send me the pull request, if you know how to fix it. We can keep the repo then as a reference for generations to come 😉

0reactions
tomburgercommented, Jun 13, 2023

Sorry, @Tratcher, for late reply. I have fixed the sample and I can confirm it works. Thanks a lot for your help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there anything in the standard for Open ID Connect to ...
Is there a standard mechanism in Open ID Connect to kill an active session? Say a client has an Access token set to...
Read more >
If an OAuth Client does NOT have Refresh Tokens, and “ID ...
If a Client does NOT have Refresh Tokens, and that “ID Token Lifetime” is set to say 5 minutes, what is the actual...
Read more >
Managing Sessions with OpenID Connect | by Sathya Bandara
If the RP wants to terminate a session when the OP session terminates (due to timeout or user logging out), RP may rely...
Read more >
Token refresh problems / after session ends not redirected ...
Unfortunately after 5minutes nothing happens an it seems the user could use the application as long he ever wants.
Read more >
OpenID Connect Session Management 1.0 - draft 05
This specification describes how OpenID Connect sessions can be created, used, and terminated. TOC. 1.1. Requirements Notation and Conventions.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found