|
| 1 | +# Generated by Django 2.2.6 on 2019-10-24 20:21 |
| 2 | + |
| 3 | +from django.conf import settings |
| 4 | +from django.db import migrations, models |
| 5 | +import django.db.models.deletion |
| 6 | +import oauth2_provider.generators |
| 7 | + |
| 8 | + |
| 9 | +class Migration(migrations.Migration): |
| 10 | + |
| 11 | + initial = True |
| 12 | + |
| 13 | + dependencies = [ |
| 14 | + migrations.swappable_dependency(settings.OAUTH2_PROVIDER_APPLICATION_MODEL), |
| 15 | + migrations.swappable_dependency(settings.OAUTH2_PROVIDER_ACCESS_TOKEN_MODEL), |
| 16 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), |
| 17 | + migrations.swappable_dependency(settings.OAUTH2_PROVIDER_REFRESH_TOKEN_MODEL), |
| 18 | + ] |
| 19 | + |
| 20 | + operations = [ |
| 21 | + migrations.CreateModel( |
| 22 | + name='SampleGrant', |
| 23 | + fields=[ |
| 24 | + ('id', models.BigAutoField(primary_key=True, serialize=False)), |
| 25 | + ('code', models.CharField(max_length=255, unique=True)), |
| 26 | + ('expires', models.DateTimeField()), |
| 27 | + ('redirect_uri', models.CharField(max_length=255)), |
| 28 | + ('scope', models.TextField(blank=True)), |
| 29 | + ('created', models.DateTimeField(auto_now_add=True)), |
| 30 | + ('updated', models.DateTimeField(auto_now=True)), |
| 31 | + ('code_challenge', models.CharField(blank=True, default='', max_length=128)), |
| 32 | + ('code_challenge_method', models.CharField(blank=True, choices=[('plain', 'plain'), ('S256', 'S256')], default='', max_length=10)), |
| 33 | + ('custom_field', models.CharField(max_length=255)), |
| 34 | + ('application', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.OAUTH2_PROVIDER_APPLICATION_MODEL)), |
| 35 | + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tests_samplegrant', to=settings.AUTH_USER_MODEL)), |
| 36 | + ], |
| 37 | + options={ |
| 38 | + 'abstract': False, |
| 39 | + }, |
| 40 | + ), |
| 41 | + migrations.CreateModel( |
| 42 | + name='SampleApplication', |
| 43 | + fields=[ |
| 44 | + ('id', models.BigAutoField(primary_key=True, serialize=False)), |
| 45 | + ('client_id', models.CharField(db_index=True, default=oauth2_provider.generators.generate_client_id, max_length=100, unique=True)), |
| 46 | + ('redirect_uris', models.TextField(blank=True, help_text='Allowed URIs list, space separated')), |
| 47 | + ('client_type', models.CharField(choices=[('confidential', 'Confidential'), ('public', 'Public')], max_length=32)), |
| 48 | + ('authorization_grant_type', models.CharField(choices=[('authorization-code', 'Authorization code'), ('implicit', 'Implicit'), ('password', 'Resource owner password-based'), ('client-credentials', 'Client credentials')], max_length=32)), |
| 49 | + ('client_secret', models.CharField(blank=True, db_index=True, default=oauth2_provider.generators.generate_client_secret, max_length=255)), |
| 50 | + ('name', models.CharField(blank=True, max_length=255)), |
| 51 | + ('skip_authorization', models.BooleanField(default=False)), |
| 52 | + ('created', models.DateTimeField(auto_now_add=True)), |
| 53 | + ('updated', models.DateTimeField(auto_now=True)), |
| 54 | + ('custom_field', models.CharField(max_length=255)), |
| 55 | + ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='tests_sampleapplication', to=settings.AUTH_USER_MODEL)), |
| 56 | + ], |
| 57 | + options={ |
| 58 | + 'abstract': False, |
| 59 | + }, |
| 60 | + ), |
| 61 | + migrations.CreateModel( |
| 62 | + name='SampleAccessToken', |
| 63 | + fields=[ |
| 64 | + ('id', models.BigAutoField(primary_key=True, serialize=False)), |
| 65 | + ('token', models.CharField(max_length=255, unique=True)), |
| 66 | + ('expires', models.DateTimeField()), |
| 67 | + ('scope', models.TextField(blank=True)), |
| 68 | + ('created', models.DateTimeField(auto_now_add=True)), |
| 69 | + ('updated', models.DateTimeField(auto_now=True)), |
| 70 | + ('custom_field', models.CharField(max_length=255)), |
| 71 | + ('application', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.OAUTH2_PROVIDER_APPLICATION_MODEL)), |
| 72 | + ('source_refresh_token', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='s_refreshed_access_token', to=settings.OAUTH2_PROVIDER_REFRESH_TOKEN_MODEL)), |
| 73 | + ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='tests_sampleaccesstoken', to=settings.AUTH_USER_MODEL)), |
| 74 | + ], |
| 75 | + options={ |
| 76 | + 'abstract': False, |
| 77 | + }, |
| 78 | + ), |
| 79 | + migrations.CreateModel( |
| 80 | + name='BaseTestApplication', |
| 81 | + fields=[ |
| 82 | + ('id', models.BigAutoField(primary_key=True, serialize=False)), |
| 83 | + ('client_id', models.CharField(db_index=True, default=oauth2_provider.generators.generate_client_id, max_length=100, unique=True)), |
| 84 | + ('redirect_uris', models.TextField(blank=True, help_text='Allowed URIs list, space separated')), |
| 85 | + ('client_type', models.CharField(choices=[('confidential', 'Confidential'), ('public', 'Public')], max_length=32)), |
| 86 | + ('authorization_grant_type', models.CharField(choices=[('authorization-code', 'Authorization code'), ('implicit', 'Implicit'), ('password', 'Resource owner password-based'), ('client-credentials', 'Client credentials')], max_length=32)), |
| 87 | + ('client_secret', models.CharField(blank=True, db_index=True, default=oauth2_provider.generators.generate_client_secret, max_length=255)), |
| 88 | + ('name', models.CharField(blank=True, max_length=255)), |
| 89 | + ('skip_authorization', models.BooleanField(default=False)), |
| 90 | + ('created', models.DateTimeField(auto_now_add=True)), |
| 91 | + ('updated', models.DateTimeField(auto_now=True)), |
| 92 | + ('allowed_schemes', models.TextField(blank=True)), |
| 93 | + ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='tests_basetestapplication', to=settings.AUTH_USER_MODEL)), |
| 94 | + ], |
| 95 | + options={ |
| 96 | + 'abstract': False, |
| 97 | + }, |
| 98 | + ), |
| 99 | + migrations.CreateModel( |
| 100 | + name='SampleRefreshToken', |
| 101 | + fields=[ |
| 102 | + ('id', models.BigAutoField(primary_key=True, serialize=False)), |
| 103 | + ('token', models.CharField(max_length=255)), |
| 104 | + ('created', models.DateTimeField(auto_now_add=True)), |
| 105 | + ('updated', models.DateTimeField(auto_now=True)), |
| 106 | + ('revoked', models.DateTimeField(null=True)), |
| 107 | + ('custom_field', models.CharField(max_length=255)), |
| 108 | + ('access_token', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='s_refresh_token', to=settings.OAUTH2_PROVIDER_ACCESS_TOKEN_MODEL)), |
| 109 | + ('application', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.OAUTH2_PROVIDER_APPLICATION_MODEL)), |
| 110 | + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tests_samplerefreshtoken', to=settings.AUTH_USER_MODEL)), |
| 111 | + ], |
| 112 | + options={ |
| 113 | + 'abstract': False, |
| 114 | + 'unique_together': {('token', 'revoked')}, |
| 115 | + }, |
| 116 | + ), |
| 117 | + ] |
0 commit comments