Skip to content

Commit e3d9786

Browse files
committed
prep different oauth mode
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
1 parent 1dd6c39 commit e3d9786

9 files changed

Lines changed: 66 additions & 12 deletions

File tree

authentik/enterprise/providers/scim/api.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
class SCIMProviderSerializerMixin:
99

1010
def validate_auth_mode(self, auth_mode: SCIMAuthenticationMode) -> SCIMAuthenticationMode:
11-
if auth_mode == SCIMAuthenticationMode.OAUTH:
11+
if auth_mode in [
12+
SCIMAuthenticationMode.OAUTH_SILENT,
13+
SCIMAuthenticationMode.OAUTH_INTERACTIVE,
14+
]:
1215
if not LicenseKey.cached_summary().status.is_valid:
1316
raise ValidationError(_("Enterprise is required to use the OAuth mode."))
1417
return auth_mode

authentik/enterprise/providers/scim/signals.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ def scim_provider_post_save(sender: type[Model], instance: SCIMProvider, created
1414
"""Create service account before provider is saved"""
1515
identifier = f"ak-providers-scim-{instance.pk}"
1616
with audit_ignore():
17-
if instance.auth_mode == SCIMAuthenticationMode.OAUTH:
17+
if instance.auth_mode in [
18+
SCIMAuthenticationMode.OAUTH_SILENT,
19+
SCIMAuthenticationMode.OAUTH_INTERACTIVE,
20+
]:
1821
user, user_created = User.objects.update_or_create(
1922
username=identifier,
2023
defaults={

authentik/enterprise/providers/scim/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def setUp(self) -> None:
4242
self.provider = SCIMProvider.objects.create(
4343
name=generate_id(),
4444
url="https://localhost",
45-
auth_mode=SCIMAuthenticationMode.OAUTH,
45+
auth_mode=SCIMAuthenticationMode.OAUTH_SILENT,
4646
auth_oauth=self.source,
4747
auth_oauth_params={
4848
"foo": "bar",
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Generated by Django 5.2.14 on 2026-05-05 22:11
2+
3+
from django.db import migrations, models
4+
from django.apps.registry import Apps
5+
6+
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
7+
8+
def update_oauth(apps: Apps, schema_editor: BaseDatabaseSchemaEditor):
9+
db_alias = schema_editor.connection.alias
10+
11+
SCIMProvider = apps.get("authentik_providers_scim", "scimprovider")
12+
13+
SCIMProvider.objects.using(db_alias).filter(auth_mode="oauth").update(auth_mode="oauth_silent")
14+
15+
class Migration(migrations.Migration):
16+
17+
dependencies = [
18+
("authentik_providers_scim", "0019_scimprovider_group_filters_and_more"),
19+
]
20+
21+
operations = [
22+
migrations.AlterField(
23+
model_name="scimprovider",
24+
name="auth_mode",
25+
field=models.TextField(
26+
choices=[
27+
("token", "Token"),
28+
("oauth_silent", "OAuth (Silent)"),
29+
("oauth_interactive", "OAuth (interactive)"),
30+
],
31+
default="token",
32+
),
33+
),
34+
]

authentik/providers/scim/models.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ class SCIMAuthenticationMode(models.TextChoices):
7272
"""SCIM authentication modes"""
7373

7474
TOKEN = "token", _("Token")
75-
OAUTH = "oauth", _("OAuth")
75+
OAUTH_SILENT = "oauth_silent", _("OAuth (Silent)")
76+
OAUTH_INTERACTIVE = "oauth_interactive", _("OAuth (interactive)")
7677

7778

7879
class SCIMCompatibilityMode(models.TextChoices):
@@ -144,7 +145,10 @@ class SCIMProvider(OutgoingSyncProvider, BackchannelProvider):
144145
)
145146

146147
def scim_auth(self) -> AuthBase:
147-
if self.auth_mode == SCIMAuthenticationMode.OAUTH:
148+
if self.auth_mode in [
149+
SCIMAuthenticationMode.OAUTH_SILENT,
150+
SCIMAuthenticationMode.OAUTH_INTERACTIVE,
151+
]:
148152
try:
149153
from authentik.enterprise.providers.scim.auth_oauth2 import SCIMOAuthAuth
150154

blueprints/schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11203,7 +11203,8 @@
1120311203
"type": "string",
1120411204
"enum": [
1120511205
"token",
11206-
"oauth"
11206+
"oauth_silent",
11207+
"oauth_interactive"
1120711208
],
1120811209
"title": "Auth mode"
1120911210
},

packages/client-ts/src/models/SCIMAuthenticationModeEnum.ts

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

schema.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54864,7 +54864,8 @@ components:
5486454864
SCIMAuthenticationModeEnum:
5486554865
enum:
5486654866
- token
54867-
- oauth
54867+
- oauth_silent
54868+
- oauth_interactive
5486854869
type: string
5486954870
SCIMMapping:
5487054871
type: object

web/src/admin/providers/scim/SCIMProviderFormForm.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ export function renderAuth(provider?: Partial<SCIMProvider>, errors: ValidationE
9292
default:
9393
case SCIMAuthenticationModeEnum.Token:
9494
return renderAuthToken(provider, errors);
95-
case SCIMAuthenticationModeEnum.Oauth:
95+
case SCIMAuthenticationModeEnum.OauthSilent:
96+
case SCIMAuthenticationModeEnum.OauthInteractive:
9697
return renderAuthOAuth(provider, errors);
9798
}
9899
}
@@ -160,12 +161,18 @@ export function renderForm({ provider, errors, update }: SCIMProviderFormProps)
160161
)}`,
161162
},
162163
{
163-
label: msg("OAuth"),
164-
value: SCIMAuthenticationModeEnum.Oauth,
165-
default: true,
164+
label: msg("OAuth (Silent)"),
165+
value: SCIMAuthenticationModeEnum.OauthSilent,
166166
description: html`${msg("Authenticate SCIM requests using OAuth.")}
167167
<ak-license-notice></ak-license-notice>`,
168168
},
169+
{
170+
label: msg("OAuth (Interactive)"),
171+
value: SCIMAuthenticationModeEnum.OauthInteractive,
172+
description: html`${msg(
173+
"Authenticate SCIM requests using OAuth, interactively authorized.",
174+
)} <ak-license-notice></ak-license-notice>`,
175+
},
169176
]}
170177
></ak-radio>
171178
</ak-form-element-horizontal>

0 commit comments

Comments
 (0)