| 1 | import uuid |
| 2 | |
| 3 | from django.conf import settings |
| 4 | from django.db import migrations, models |
| 5 | import django.db.models.deletion |
| 6 | |
| 7 | from oauth2_provider.settings import oauth2_settings |
| 8 | |
| 9 | |
| 10 | class Migration(migrations.Migration): |
| 11 | |
| 12 | dependencies = [ |
| 13 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), |
| 14 | ('oauth2_provider', '0003_auto_20201211_1314'), |
| 15 | ] |
| 16 | |
| 17 | operations = [ |
| 18 | migrations.AddField( |
| 19 | model_name='application', |
| 20 | name='algorithm', |
| 21 | field=models.CharField(blank=True, choices=[("", "No OIDC support"), ('RS256', 'RSA with SHA-2 256'), ('HS256', 'HMAC with SHA-2 256')], default='', max_length=5), |
| 22 | ), |
| 23 | migrations.AlterField( |
| 24 | model_name='application', |
| 25 | name='authorization_grant_type', |
| 26 | field=models.CharField(choices=[('authorization-code', 'Authorization code'), ('implicit', 'Implicit'), ('password', 'Resource owner password-based'), ('client-credentials', 'Client credentials'), ('openid-hybrid', 'OpenID connect hybrid')], max_length=32), |
| 27 | ), |
| 28 | migrations.CreateModel( |
| 29 | name='IDToken', |
| 30 | fields=[ |
| 31 | ('id', models.BigAutoField(primary_key=True, serialize=False)), |
| 32 | ("jti", models.UUIDField(unique=True, default=uuid.uuid4, editable=False, verbose_name="JWT Token ID")), |
| 33 | ('expires', models.DateTimeField()), |
| 34 | ('scope', models.TextField(blank=True)), |
| 35 | ('created', models.DateTimeField(auto_now_add=True)), |
| 36 | ('updated', models.DateTimeField(auto_now=True)), |
| 37 | ('application', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=oauth2_settings.APPLICATION_MODEL)), |
| 38 | ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='oauth2_provider_idtoken', to=settings.AUTH_USER_MODEL)), |
| 39 | ], |
| 40 | options={ |
| 41 | 'abstract': False, |
| 42 | 'swappable': 'OAUTH2_PROVIDER_ID_TOKEN_MODEL', |
| 43 | }, |
| 44 | ), |
| 45 | migrations.AddField( |
| 46 | model_name='accesstoken', |
| 47 | name='id_token', |
| 48 | field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='access_token', to=oauth2_settings.ID_TOKEN_MODEL), |
| 49 | ), |
| 50 | migrations.AddField( |
| 51 | model_name="grant", |
| 52 | name="nonce", |
| 53 | field=models.CharField(blank=True, max_length=255, default=""), |
| 54 | ), |
| 55 | migrations.AddField( |
| 56 | model_name="grant", |
| 57 | name="claims", |
| 58 | field=models.TextField(blank=True), |
| 59 | ), |
| 60 | ] |