Repository navigation
providers/scim: add Basic authentication mode - #26277
Merged
Merged
Conversation
Only the interactive OAuth mode uses the start and callback URLs. The guard listed the modes that do not need them, so any mode added later would get a URL it cannot use. Check for the one mode that does.
Some SCIM service providers only accept HTTP Basic authentication and have no way to consume a bearer token. Add a "basic" mode that stores a username and password on the provider, alongside the existing token and OAuth modes. The header is built here rather than with requests' HTTPBasicAuth, which encodes credentials as latin-1. RFC 7617 expects UTF-8. The password is write-only over the API, like the existing token field. Basic needs no license, same as the token mode. Closes #15267
Assert the Authorization header authentik sends for the token and basic modes, including UTF-8 encoding of non-ASCII credentials.
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
BeryJu
approved these changes
Sep 22, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details
What does this PR change?
basicauthentication mode on the SCIM provider, alongside the existing token and OAuth modes. It sendsAuthorization: Basic base64(username:password).auth_basic_userandauth_basic_password, empty by default. The password iswrite_onlyover the API matching howtokenis already handled.get_auth_oauth_url_callbackandget_auth_oauth_url_startreturnedNonewhen the mode was in[TOKEN, OAUTH_SILENT]. Adding a fourth mode to that enum would have made both functions hand out OAuth authorize URLs to a Basic-auth provider. They now check forOAUTH_INTERACTIVE, the one mode that uses those URLs.Migration
0022adds the two fields and widens theauth_modechoices. Existing providers are untouched;auth_modestill defaults totoken.Why is this change needed?
Some SCIM service providers only accept HTTP Basic. The one in #15267 is Unity, whose SCIM support offers no other scheme. Both of authentik's current modes send
Authorization: Bearer, so there is no way to provision to those endpoints today.I don't think this is an exotic case.
httpbasicis one of the authentication scheme types SCIM's ownServiceProviderConfigresource advertises (RFC 7643), next tooauthbearertoken.How was this tested?
New unit tests in
authentik/providers/scim/tests/test_auth.pyassert theAuthorizationheader authentik actually puts on the wire, throughrequests_mock. Three cases: token, basic, and basic with non-ASCII credentials. RFC 7617 expects UTF-8.What I ran locally:
manage.py test authentik/providers/scim authentik/enterprise/providers/scim: 76 passed.ak makemigrations --check --dry-run: "No changes detected", migration0022matches the model.make gen-buildand thetypescript-fetchgenerator:schema.yml,blueprints/schema.jsonandpackages/client-tsregenerate with only the new field and enum value.pnpm --dir web run tscandrun lint, plusruff check,blackandoxfmt.Verified against a live Unity SCIM tenant. GET /ServiceProviderConfig and GET /Users both returned 200 with the Basic header this branch generates. Provisioning was run with dry_run enabled so the "full sync" was never really tested.
Linked issues
closes #15267
AI disclosure
The code and the analysis behind it were done with AI assistance (Claude Opus 5). I reviewed every commit, ran the test and codegen steps listed above myself, and can stand behind the code.
Checklist
make all)make docs)