Skip to content

sources/ldap: Switch to new connection tracking, deprecated attribute-based connection - #21392

Merged
BeryJu merged 16 commits into
mainfrom
sources/ldap/deprecate-old-ldap_uniq-attr
Apr 7, 2026
Merged

BeryJu merged 16 commits into
mainfrom
sources/ldap/deprecate-old-ldap_uniq-attr

Conversation

@BeryJu

@BeryJu BeryJu commented Apr 5, 2026 •

Copy link
Copy Markdown
Member

this is a requirement for #19069

We've been tracking user/group-source connections with proper connection objects since 7fd35b1 (#13796), but we still use ldap_uniq in the attributes of the user/group to match users for sync.

This switches the logic around to use the connection object first, with a fallback for the old setup (this shouldn't really occur). The goal is to eventually get rid of the LDAP_UNIQUENESS constant.

This also contains the UI to show user/group connections and the ability to create those connections manually, mainly so we can adjust the error message to point to that new form, instead of the old attribute.

cc @krejcar25

BeryJu added 2 commits April 5, 2026 23:18
Signed-off-by: Jens Langhammer <[email protected]>
Signed-off-by: Jens Langhammer <[email protected]>
@BeryJu
BeryJu requested a review from rissson April 5, 2026 21:27
@BeryJu
BeryJu requested a review from a team as a code owner April 5, 2026 21:27
@netlify

netlify Bot commented Apr 5, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 751e654
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/69d2d3d4af07d0000840a867
😎 Deploy Preview https://deploy-preview-21392--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.

@codecov

codecov Bot commented Apr 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.36066% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.63%. Comparing base (0c9c1ec) to head (f586e1e).
⚠️ Report is 30 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
authentik/sources/ldap/sync/groups.py 95.00% 1 Missing ⚠️
authentik/sources/ldap/sync/users.py 95.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #21392   +/-   ##
=======================================
  Coverage   92.62%   92.63%           
=======================================
  Files        1016     1018    +2     
  Lines       58378    58458   +80     
  Branches     1494     1494           
=======================================
+ Hits        54075    54153   +78     
- Misses       4263     4267    +4     
+ Partials       40       38    -2     
Flag Coverage Δ
conformance 37.05% <40.16%> (-0.02%) ⬇️
e2e 42.97% <63.11%> (+<0.01%) ⬆️
integration 33.97% <40.16%> (-0.02%) ⬇️
rust 53.68% <ø> (+0.13%) ⬆️
unit 91.87% <98.36%> (+<0.01%) ⬆️
unit-migrate 91.93% <98.36%> (+<0.01%) ⬆️

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

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

@github-actions

github-actions Bot commented Apr 5, 2026 •

Copy link
Copy Markdown
Contributor

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-f586e1e586de800fbb1c7b47b86be9150b852b15
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
    image:
        repository: ghcr.io/goauthentik/dev-server
        tag: gh-f586e1e586de800fbb1c7b47b86be9150b852b15

Afterwards, run the upgrade commands from the latest release notes.

BeryJu added 6 commits April 6, 2026 01:51
Signed-off-by: Jens Langhammer <[email protected]>
Signed-off-by: Jens Langhammer <[email protected]>
Signed-off-by: Jens Langhammer <[email protected]>
Signed-off-by: Jens Langhammer <[email protected]>
Signed-off-by: Jens Langhammer <[email protected]>
@BeryJu
BeryJu requested a review from a team as a code owner April 6, 2026 00:28
@netlify

netlify Bot commented Apr 6, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit f586e1e
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/69d441e10ec4fd0008a87a84
😎 Deploy Preview https://deploy-preview-21392--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.

BeryJu added 5 commits April 6, 2026 02:32
Signed-off-by: Jens Langhammer <[email protected]>
Signed-off-by: Jens Langhammer <[email protected]>
Signed-off-by: Jens Langhammer <[email protected]>
Signed-off-by: Jens Langhammer <[email protected]>
@netlify

netlify Bot commented Apr 6, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit 5d36a6f
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/69d382494a11560008b5d590
😎 Deploy Preview https://deploy-preview-21392--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.

@BeryJu BeryJu added the area:frontend Features or issues related to the browser, TypeScript, Node.js, etc label Apr 6, 2026
BeryJu added 3 commits April 6, 2026 12:39
Signed-off-by: Jens Langhammer <[email protected]>
Signed-off-by: Jens Langhammer <[email protected]>
Signed-off-by: Jens Langhammer <[email protected]>
@@ -0,0 +1,87 @@
import "#elements/forms/DeleteBulkForm";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is something we want to do for all sources actually.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, we kinda do, ish

for sources like kerberos/ldap/scim it makes sense to have here, but for OAuth/SAML I think it makes more sense on the individual users' page? or Maybe both I suppose

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah probably both for all sources

@rissson rissson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks good, I haven't read the tests though.

Comment on lines +111 to +121
groups = GroupLDAPSourceConnection.objects.filter(identifier=group_uniq).select_related(
"group"
)
if not groups.exists():
if self._source.sync_groups:
self._task.info(
f"Group does not exist in our DB yet, run sync_groups first: '{group_dn}'",
group=group_dn,
)
return None
self.group_cache[group_uniq] = groups.first()
self.group_cache[group_uniq] = groups.first().group

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
groups = GroupLDAPSourceConnection.objects.filter(identifier=group_uniq).select_related(
"group"
)
if not groups.exists():
if self._source.sync_groups:
self._task.info(
f"Group does not exist in our DB yet, run sync_groups first: '{group_dn}'",
group=group_dn,
)
return None
self.group_cache[group_uniq] = groups.first()
self.group_cache[group_uniq] = groups.first().group
group_source_connection = GroupLDAPSourceConnection.objects.filter(identifier=group_uniq).select_related(
"group"
).first()
if group_source_connection is None:
if self._source.sync_groups:
self._task.info(
f"Group does not exist in our DB yet, run sync_groups first: '{group_dn}'",
group=group_dn,
)
return None
self.group_cache[group_uniq] = group_source_connection.group

saves a db query, but this is really nitpicking at this point

@BeryJu
BeryJu merged commit 57d2135 into main Apr 7, 2026
109 checks passed
@BeryJu
BeryJu deleted the sources/ldap/deprecate-old-ldap_uniq-attr branch April 7, 2026 14:13
davepgreene pushed a commit to davepgreene/authentik that referenced this pull request Apr 13, 2026
…-based connection (goauthentik#21392)

* init user

Signed-off-by: Jens Langhammer <[email protected]>

* fix and update groups

Signed-off-by: Jens Langhammer <[email protected]>

* split api

Signed-off-by: Jens Langhammer <[email protected]>

* include user and group in ldap conn

Signed-off-by: Jens Langhammer <[email protected]>

* unrelated cleanup

Signed-off-by: Jens Langhammer <[email protected]>

* add ldap users/groups page

Signed-off-by: Jens Langhammer <[email protected]>

* ui cleanup

Signed-off-by: Jens Langhammer <[email protected]>

* fixup

Signed-off-by: Jens Langhammer <[email protected]>

* update error message

Signed-off-by: Jens Langhammer <[email protected]>

* fix import

Signed-off-by: Jens Langhammer <[email protected]>

* add forms for user/group connections

Signed-off-by: Jens Langhammer <[email protected]>

* fix py sync

Signed-off-by: Jens Langhammer <[email protected]>

* fixup web

Signed-off-by: Jens Langhammer <[email protected]>

* fix connection not always saved

Signed-off-by: Jens Langhammer <[email protected]>

* more tests

Signed-off-by: Jens Langhammer <[email protected]>

* fix help text

Signed-off-by: Jens Langhammer <[email protected]>

---------

Signed-off-by: Jens Langhammer <[email protected]>
davepgreene pushed a commit to davepgreene/authentik that referenced this pull request Apr 13, 2026
…-based connection (goauthentik#21392)

* init user

Signed-off-by: Jens Langhammer <[email protected]>

* fix and update groups

Signed-off-by: Jens Langhammer <[email protected]>

* split api

Signed-off-by: Jens Langhammer <[email protected]>

* include user and group in ldap conn

Signed-off-by: Jens Langhammer <[email protected]>

* unrelated cleanup

Signed-off-by: Jens Langhammer <[email protected]>

* add ldap users/groups page

Signed-off-by: Jens Langhammer <[email protected]>

* ui cleanup

Signed-off-by: Jens Langhammer <[email protected]>

* fixup

Signed-off-by: Jens Langhammer <[email protected]>

* update error message

Signed-off-by: Jens Langhammer <[email protected]>

* fix import

Signed-off-by: Jens Langhammer <[email protected]>

* add forms for user/group connections

Signed-off-by: Jens Langhammer <[email protected]>

* fix py sync

Signed-off-by: Jens Langhammer <[email protected]>

* fixup web

Signed-off-by: Jens Langhammer <[email protected]>

* fix connection not always saved

Signed-off-by: Jens Langhammer <[email protected]>

* more tests

Signed-off-by: Jens Langhammer <[email protected]>

* fix help text

Signed-off-by: Jens Langhammer <[email protected]>

---------

Signed-off-by: Jens Langhammer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend area:frontend Features or issues related to the browser, TypeScript, Node.js, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants