goauthentik / goauthentik/authentik

OAuth2 Provider: Add maximum session lifetime (absolute expiry) setting

Open
#20,223 4 comments 0 reactions 0 assignees View on GitHub
enhancement enhancement/confirmed
Dominant language
Python
Stars
25.6k
Forks
2k
Avg merge
1d 2h
Merged PRs (30d)
651

Description

### Is your feature request related to a problem?

The OAuth2 provider has no way to enforce an absolute session lifetime. Because refresh token rotation issues a new refresh token with a fresh validity period, an active user's session can be extended indefinitely.

There is no setting on the OAuth2 provider to say "regardless of refresh token rotation, this user must re-authenticate after X hours."

### Describe the solution you'd like

A maximum session lifetime setting on the OAuth2 provider, specified in the same hours=X,days=Y format as other duration fields.

### Describe alternatives that you've considered

- Setting Refresh Token threshold to seconds=1. This minimizes the window in which rotation can happen, but doesn't eliminate it. If a refresh request happens to land in that 1-second window, a new refresh token is still issued with a full validity period, making the session indefinitely extendable. It's probabilistic, not deterministic.

- Enforcing the limit application-side: defeats the purpose of centralizing auth in Authentik.

### Additional context

I am not sure whether this beats the whole purpose of refresh tokens and I would like to hear your feedback! If some things are unclear, I'll be happy to explain further.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the OAuth2 provider's refresh-token rotation path and the existing duration settings that use hours=X,days=Y. Determine how an absolute maximum session lifetime should interact with refresh-token issuance, then add coverage showing that refreshes cannot extend the session beyond the configured lifetime and that re-authentication is required.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authentication
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.