Skip to content

sources/ldap: respect accountExpires attributes - #26135

Merged
dominic-r merged 14 commits into
goauthentik:mainfrom
jsachs:feature/ldap-account-expires
Oct 27, 2026
Merged

dominic-r merged 14 commits into
goauthentik:mainfrom
jsachs:feature/ldap-account-expires

Conversation

@jsachs

@jsachs jsachs commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Details

What does this PR change?

Adds support for Active Directory’s accountExpires attribute during LDAP user synchronization.

  • Deactivates expired accounts and removes their authentik sessions.
  • Supports raw LDAP timestamps and schema-decoded datetimes, including both AD “never expires” values.
  • Combines expiration, AD disabled/locked status, and existing FreeIPA lock status before saving the user, preventing one check from overriding another.
  • Preserves AD’s existing authority over is_active when userAccountControl is available. Extending or clearing expiration allows reactivation when directory restrictions permit it.
  • Reports invalid expiration values before updating the affected user.
  • Documents synchronization timing and reactivation behavior.

Why is this change needed?

authentik currently synchronizes AD disabled/locked status but does not account for account expiration. An expired AD account can therefore remain active in authentik.
A custom property mapping is not sufficient to address this reliably: the existing AD handler can overwrite the mapping’s is_active result based on userAccountControl. AD’s timestamp encoding and “never expires” sentinels also require special handling.
This change evaluates directory restrictions together so that expired accounts are consistently deactivated.

How was this tested?

Ran the LDAP source test suite, which includes new coverage.

Linked issues

Closes #22035

Checklist

  • The project has been linted, built, and tested (make all)
  • The documentation has been updated and formatted (make docs)
  • I have read the AI usage policy.

@netlify

netlify Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit d654fcf
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/6ab21d60b2d3b300089de579
😎 Deploy Preview https://deploy-preview-26135--authentik-integrations.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit d654fcf
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/6ab21d5f581441000852c6b4
😎 Deploy Preview https://deploy-preview-26135--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit d654fcf
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6ab21d60ca1e8200082eeec3
😎 Deploy Preview https://deploy-preview-26135--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@jsachs
jsachs force-pushed the feature/ldap-account-expires branch from ded6662 to ebc55c1 Compare September 14, 2026 13:52
@jsachs
jsachs marked this pull request as ready for review September 15, 2026 13:17
@jsachs
jsachs requested review from a team as code owners September 15, 2026 13:17
@dewi-tik
dewi-tik self-requested a review September 15, 2026 13:50
@codecov

codecov Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.42%. Comparing base (a1e049b) to head (4b12e00).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##             main   #26135       +/-   ##
===========================================
+ Coverage   31.41%   92.42%   +61.00%     
===========================================
  Files        1179     1194       +15     
  Lines       79312    81001     +1689     
  Branches     4497     4497               
===========================================
+ Hits        24919    74864    +49945     
+ Misses      54327     6071    -48256     
  Partials       66       66               
Flag Coverage Δ
conformance 32.18% <6.70%> (+2.50%) ⬆️
e2e 36.85% <18.99%> (?)
integration 28.72% <6.70%> (-0.40%) ⬇️
rust 45.98% <ø> (ø)
unit 94.10% <100.00%> (?)
unit-migrate 94.10% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@github-project-automation github-project-automation Bot moved this from Todo to In Progress in authentik Core Sep 22, 2026
@dominic-r
dominic-r merged commit f38ea3d into goauthentik:main Oct 27, 2026
163 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in authentik Core Oct 27, 2026
kensternberg-authentik added a commit that referenced this pull request Nov 5, 2026
* main: (89 commits)
  providers/scim: scope-aware adoption (#26174)
  sources/ldap: respect accountExpires attributes (#26135)
  web/flows: never let continuous login block the final redirect (#26269)
  website: document password hash import restrictions (#24235)
  core: restrict imported password hashers (#24234)
  core, web: update translations (#27148)
  server: retry requests on connections closed by a recycled worker (#27275)
  packages/django-postgres-cache, flows: count cache keys in the database (#25808)
  events: simplify execution of event rules/notifications (#26873)
  core: bump github.com/pires/go-proxyproto from 0.15.0 to 0.16.0 (#27260)
  core: bump goauthentik/platform-ssh from 26.04-ak-0.72.3 to 26.04-ak-0.72.4 in /tests/e2e (#27263)
  core: bump goauthentik/selenium from 155.0-ak-0.72.3 to 155.0-ak-0.72.4 in /tests/e2e (#27261)
  core: bump astral-sh/uv from 0.13.5 to 0.13.6 in /lifecycle/container (#27264)
  core: bump jsonpatch from 1.35 to 1.36 (#27269)
  outposts: refresh channel groups on hello (#27136)
  core: bump certifi from 2026.10.19 to 2026.10.23 (#27266)
  core: bump pluggy from 1.6.0 to v1.7.0 (#27238)
  core: bump markupsafe from 3.0.3 to v3.0.4 (#27225)
  core: bump httptools from 0.8.0 to v0.9.0 (#27219)
  core: bump iniconfig from 2.3.0 to v2.3.1 (#27221)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Take the expiration date in LDAP/AD into account

4 participants