WIP: feat(session): session policy declared in host code, checked against the Authentik provider #73
Draft
james.maes
wants to merge 4 commits from
feat/session-policy into develop
pull from: feat/session-policy
merge into: QRun-IO:develop
QRun-IO:develop
QRun-IO:release/0.1
QRun-IO:merge/develop-into-release-0-1-rc13
QRun-IO:perf/policy-resolution-single-universe
QRun-IO:fix/health-token-broker-develop
QRun-IO:fix/health-token-broker-only-when-tokens-on
QRun-IO:merge/develop-into-release-0-1-rc10
QRun-IO:feat/policy-1-1-deny-prefix
QRun-IO:fix/create-time-approval-20261106
QRun-IO:automation/qbit-rc-pending
QRun-IO:review/local-latest
QRun-IO:qualification/auth-bootstrap-order-20261103
QRun-IO:qualification/auth-bootstrap-threads2-20261103
QRun-IO:qualification/auth-bootstrap-threads-20261103
QRun-IO:qualification/auth-bootstrap-20261103
QRun-IO:main
QRun-IO:qualification/central-actions-20261031
QRun-IO:dependabot/maven/develop/maven-minor-and-patch-3ab577e7f8
QRun-IO:dependabot/github_actions/develop/github-actions-feffc63bfd
QRun-IO:feature/orb-0.8-track
QRun-IO:feature/orb-0.7.18
QRun-IO:feature/orb-0.7.17
QRun-IO:feature/orb-standardize-release-0.1
QRun-IO:feature/orb-main-standardization
QRun-IO:feature/shared-codeql
QRun-IO:feature/orb-0712-stable-gate
QRun-IO:feature/orb-rc-worker
QRun-IO:feature/align-shared-workers
QRun-IO:feature/orb-0.7.11
QRun-IO:feature/central-ci
QRun-IO:feature/maintenance-service-principal
QRun-IO:feature/mapper-group-attributes-warning
QRun-IO:feature/broker-probe-token-exchange
QRun-IO:ci/release-rc-secrets-inherit
QRun-IO:fix/help-bundle-version
QRun-IO:feature/health-checks
QRun-IO:feature/help-bundle
QRun-IO:feature/tables-populated-defaults
QRun-IO:feature/policy-full-access
QRun-IO:feature/log-effective-features
QRun-IO:feature/policy-editor-preview
QRun-IO:feature/orb-0.6.9
QRun-IO:feature/token-scopes
QRun-IO:feature/guardrails-rc6
QRun-IO:feature/token-management
QRun-IO:feature/token-preferences
QRun-IO:feature/arch-rc5
QRun-IO:feature/token-spec
QRun-IO:feature/mapper-automated-sessions
QRun-IO:feature/policy-feature-permissions
QRun-IO:feature/policy-cutover
QRun-IO:feature/release-rc-automation
QRun-IO:feature/user-group-crud
QRun-IO:feature/policy-editor
QRun-IO:feature/policy-model
QRun-IO:feature/policy-spec
QRun-IO:feature/v1-lifecycle
QRun-IO:feature/ga-only-release-tags
QRun-IO:feature/snake-case-table-names
QRun-IO:chore/qrun-repo-standard
No Reviewers
Labels
Clear labels
architecture
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
java
question
release:rc
secuurity
wontfix
Architecture review: coupling, cohesion, UI API
Something isn't working
Improvements or additions to documentation
This issue or pull request already exists
New feature or request
Pull requests that update GitHub Actions code
Good for newcomers
Extra attention is needed
This doesn't seem right
Pull requests that update java code
Further information is requested
Merging this develop PR cuts the next release candidate
This will not be worked on
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: QRun-IO/qbit-authentik#73
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What
A host application states in code how long a sign-in lasts, and the qbit checks that the Authentik provider agrees. Nothing is written to Authentik.
AuthentikSessionPolicy: idle timeout, absolute maximum and access-token lifetime, in seconds.problems()refuses numbers that cannot be enforced (access token under 120 s, idle timeout under twice the access token, maximum not longer than the idle timeout or over 90 days).applyTo(OAuth2AuthenticationMetaData)sets core'smaxSessionLifetimeSecondsand refuses meta-data without refresh tokens or theoffline_accessscope.AuthentikQBitConfig.withSessionPolicy(...)(needsappClientId): config validation fails when the instance's OAuth2 authentication does not carry the policy.authentik.session_policy(hourly, registered only when a policy is stated): reads the app's provider withGET /providers/oauth2/?client_id=and keeps only the validity settings and grant types. UP whenaccess_token_validity,refresh_token_validityandrefresh_token_threshold(0) match; DEGRADED naming each difference in seconds; DOWN when the service account cannot view the provider.view_oauth2provideras an object permission on the app's own provider, never model-wide (the provider API returns client secrets).Hosts that state no policy are unaffected: no new check, no new API call, no schema change.
Why this shape
Owner decision (2026-11-10): the timeout is declared in versioned code, not edited afterwards through an admin action. The provider's validities stay in its blueprint; this check is what keeps the two from disagreeing unnoticed.
How the limits are enforced, read in source: QQQ core 4.1.0-RC.29
OAuth2AuthenticationModulerenews an expired access token with the stored refresh token and stops atmaxSessionLifetimeSeconds; Authentik 2026.8.5providers/oauth2/views/token.pyissues a new refresh token at every renewal whenrefresh_token_thresholdis 0, valid forrefresh_token_validityfrom that moment, and revokes the old one. So the idle timeout is the provider's refresh-token validity.Verified
620dfcc(run 7370,mvn -T1C verify, contract stack Authentik 2026.8.3): success. The code is that of5bf8672, whose build (run 7361) passed with 634 unit tests and 111 contract tests,SessionPolicyContractITamong them;f19ddf8changes the README only and620dfccis an empty commit to re-run CI.f19ddf8) failed before any contract test ran: the runner could not start Testcontainers (Docker networking error). Unit tests passed in it.848378d, run 7358) failed inSessionPolicyContractIT: Authentik answers 403, not an empty list, to an account that may view no provider.5bf8672reports that as DOWN (unverified) with the grant to add../mvnw -B verify -DskipITson5bf8672: 634 tests, 0 failures, BUILD SUCCESS. Contract ITs were not run locally.Release
After merge: a new RC (0.1.0-RC.13) through the normal release flow. GG Forge then pins it and passes its session numbers in (gg-engineering/gg-forge PR 48).
🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.