Skip to content

providers/scim: add Basic authentication mode - #26277

Merged
BeryJu merged 7 commits into
goauthentik:mainfrom
Arzaroth:feature/scim-basic-auth
Sep 22, 2026
Merged

BeryJu merged 7 commits into
goauthentik:mainfrom
Arzaroth:feature/scim-basic-auth

Conversation

@Arzaroth

Copy link
Copy Markdown
Contributor

Details

What does this PR change?

  • New basic authentication mode on the SCIM provider, alongside the existing token and OAuth modes. It sends Authorization: Basic base64(username:password).
  • Two new fields, auth_basic_user and auth_basic_password, empty by default. The password is write_only over the API matching how token is already handled.
  • One change to existing OAuth code. get_auth_oauth_url_callback and get_auth_oauth_url_start returned None when 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 for OAUTH_INTERACTIVE, the one mode that uses those URLs.
  • Admin form: a third radio option, plus a username field and a secret field.
  • Docs: a Basic section under the SCIM provider's authentication modes page.

Migration 0022 adds the two fields and widens the auth_mode choices. Existing providers are untouched; auth_mode still defaults to token.

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. httpbasic is one of the authentication scheme types SCIM's own ServiceProviderConfig resource advertises (RFC 7643), next to oauthbearertoken.

How was this tested?

New unit tests in authentik/providers/scim/tests/test_auth.py assert the Authorization header authentik actually puts on the wire, through requests_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", migration 0022 matches the model.
  • make gen-build and the typescript-fetch generator: schema.yml, blueprints/schema.json and packages/client-ts regenerate with only the new field and enum value.
  • pnpm --dir web run tsc and run lint, plus ruff check, black and oxfmt.

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

  • 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.

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.
@Arzaroth
Arzaroth requested review from a team as code owners September 20, 2026 07:24
@netlify

netlify Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 95dc433
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6ab27dd19bcd9b00088079b5
😎 Deploy Preview https://deploy-preview-26277--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 Sep 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.06%. Comparing base (18ef70e) to head (95dc433).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##             main   #26277       +/-   ##
===========================================
+ Coverage   65.93%   92.06%   +26.13%     
===========================================
  Files        1175     1176        +1     
  Lines       76580    76623       +43     
  Branches     4121     4121               
===========================================
+ Hits        50495    70545    +20050     
+ Misses      26032     6025    -20007     
  Partials       53       53               
Flag Coverage Δ
conformance 33.41% <20.00%> (+0.42%) ⬆️
e2e 38.20% <20.00%> (?)
integration 29.70% <20.00%> (-0.45%) ⬇️
rust 44.79% <ø> (ø)
unit 93.60% <100.00%> (+27.35%) ⬆️
unit-migrate 93.61% <100.00%> (+46.66%) ⬆️

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.

@BeryJu
BeryJu merged commit 239399c into goauthentik:main Sep 22, 2026
139 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Basic authentication in SCIM provider

2 participants