From 66a3497a1ceaca4a79000fc4e51ec6e3353702de Mon Sep 17 00:00:00 2001 From: Ignacio Fiorentino Date: Mon, 12 Dec 2016 16:46:21 -0300 Subject: [PATCH] Fix refresh_token cannot be primary key if null. --- .../0021_refresh_token_not_unique.py | 21 +++++++++++++++++++ oidc_provider/models.py | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 oidc_provider/migrations/0021_refresh_token_not_unique.py diff --git a/oidc_provider/migrations/0021_refresh_token_not_unique.py b/oidc_provider/migrations/0021_refresh_token_not_unique.py new file mode 100644 index 0000000..691ae8e --- /dev/null +++ b/oidc_provider/migrations/0021_refresh_token_not_unique.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10 on 2016-12-12 19:44 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('oidc_provider', '0020_client__post_logout_redirect_uris'), + ] + + operations = [ + migrations.AlterField( + model_name='token', + name='refresh_token', + field=models.CharField(default='', max_length=255, unique=True, verbose_name='Refresh Token'), + preserve_default=False, + ), + ] diff --git a/oidc_provider/models.py b/oidc_provider/models.py index ddc5016..9c456b5 100644 --- a/oidc_provider/models.py +++ b/oidc_provider/models.py @@ -125,7 +125,7 @@ class Code(BaseCodeTokenModel): class Token(BaseCodeTokenModel): access_token = models.CharField(max_length=255, unique=True, verbose_name=_(u'Access Token')) - refresh_token = models.CharField(max_length=255, unique=True, null=True, verbose_name=_(u'Refresh Token')) + refresh_token = models.CharField(max_length=255, unique=True, verbose_name=_(u'Refresh Token')) _id_token = models.TextField(verbose_name=_(u'ID Token')) def id_token():