From ba9a4efc9bbec399f9ca1f41dc7602105532a5f6 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 21 Jul 2021 00:34:01 +0200 Subject: [PATCH] providers/oauth2: fix nonce field not being optional Signed-off-by: Jens Langhammer --- .../0016_alter_authorizationcode_nonce.py | 18 ++++++++++++++++++ authentik/providers/oauth2/models.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 authentik/providers/oauth2/migrations/0016_alter_authorizationcode_nonce.py diff --git a/authentik/providers/oauth2/migrations/0016_alter_authorizationcode_nonce.py b/authentik/providers/oauth2/migrations/0016_alter_authorizationcode_nonce.py new file mode 100644 index 000000000..f0da01639 --- /dev/null +++ b/authentik/providers/oauth2/migrations/0016_alter_authorizationcode_nonce.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.5 on 2021-07-20 22:32 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("authentik_providers_oauth2", "0015_auto_20210703_1313"), + ] + + operations = [ + migrations.AlterField( + model_name="authorizationcode", + name="nonce", + field=models.TextField(default=None, null=True, verbose_name="Nonce"), + ), + ] diff --git a/authentik/providers/oauth2/models.py b/authentik/providers/oauth2/models.py index ccc411d0a..5ae621389 100644 --- a/authentik/providers/oauth2/models.py +++ b/authentik/providers/oauth2/models.py @@ -338,7 +338,7 @@ class AuthorizationCode(ExpiringModel, BaseGrantModel): """OAuth2 Authorization Code""" code = models.CharField(max_length=255, unique=True, verbose_name=_("Code")) - nonce = models.TextField(blank=True, default="", verbose_name=_("Nonce")) + nonce = models.TextField(null=True, default=None, verbose_name=_("Nonce")) is_open_id = models.BooleanField( default=False, verbose_name=_("Is Authentication?") )