Skip to content

Commit

Permalink
✨ [#80] Support configuring basic auth for token endpoint
Browse files Browse the repository at this point in the history
Certain OIDC providers require the client credentials to be sent
in the Basic Auth request header rather than in the request
body. This is now configurable in the admin.
  • Loading branch information
sergei-maertens committed Feb 6, 2024
1 parent 7a24ff9 commit fb09fff
Show file tree
Hide file tree
Showing 6 changed files with 395 additions and 2 deletions.
1 change: 1 addition & 0 deletions mozilla_django_oidc_db/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class OpenIDConnectConfigAdmin(SingletonModelAdmin):
"oidc_op_jwks_endpoint",
"oidc_op_authorization_endpoint",
"oidc_op_token_endpoint",
"oidc_token_use_basic_auth",
"oidc_op_user_endpoint",
)
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 3.2.23 on 2024-02-05 16:51

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("mozilla_django_oidc_db", "0014_alter_openidconnectconfig_groups_claim"),
]

operations = [
migrations.AddField(
model_name="openidconnectconfig",
name="oidc_token_use_basic_auth",
field=models.BooleanField(
default=False,
help_text="If enabled, the client ID and secret are sent in the HTTP Basic auth header when obtaining the access token. Otherwise, they are sent in the request body.",
verbose_name="Use Basic auth for token endpoint",
),
),
]
9 changes: 9 additions & 0 deletions mozilla_django_oidc_db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@ class OpenIDConnectConfigBase(SingletonModel):
max_length=1000,
help_text=_("URL of your OpenID Connect provider token endpoint"),
)
oidc_token_use_basic_auth = models.BooleanField(
_("Use Basic auth for token endpoint"),
default=False,
help_text=_(
"If enabled, the client ID and secret are sent in the HTTP Basic auth "
"header when obtaining the access token. Otherwise, they are sent in the "
"request body.",
),
)
oidc_op_user_endpoint = models.URLField(
_("User endpoint"),
max_length=1000,
Expand Down
Loading

0 comments on commit fb09fff

Please sign in to comment.