-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
afabiani
committed
Aug 16, 2019
1 parent
ee0f9ff
commit 69c0c2f
Showing
17 changed files
with
458 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
from django.conf import settings | ||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
import oauth2_provider.generators | ||
import oauth2_provider.validators | ||
from oauth2_provider.settings import oauth2_settings | ||
|
||
|
||
class Migration(migrations.Migration): | ||
""" | ||
The following migrations are squashed here: | ||
- 0001_initial.py | ||
- 0002_08_updates.py | ||
- 0003_auto_20160316_1503.py | ||
- 0004_auto_20160525_1623.py | ||
- 0005_auto_20170514_1141.py | ||
- 0006_auto_20171214_2232.py | ||
""" | ||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL) | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Application', | ||
fields=[ | ||
('id', models.BigAutoField(serialize=False, primary_key=True)), | ||
('client_id', models.CharField(default=oauth2_provider.generators.generate_client_id, unique=True, max_length=100, db_index=True)), | ||
('redirect_uris', models.TextField(help_text='Allowed URIs list, space separated', blank=True)), | ||
('client_type', models.CharField(max_length=32, choices=[('confidential', 'Confidential'), ('public', 'Public')])), | ||
('authorization_grant_type', models.CharField(max_length=32, choices=[('authorization-code', 'Authorization code'), ('implicit', 'Implicit'), ('password', 'Resource owner password-based'), ('client-credentials', 'Client credentials')])), | ||
('client_secret', models.CharField(default=oauth2_provider.generators.generate_client_secret, max_length=255, db_index=True, blank=True)), | ||
('name', models.CharField(max_length=255, blank=True)), | ||
('user', models.ForeignKey(related_name="oauth2_provider_application", blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE)), | ||
('skip_authorization', models.BooleanField(default=False)), | ||
('created', models.DateTimeField(auto_now_add=True)), | ||
('updated', models.DateTimeField(auto_now=True)), | ||
], | ||
options={ | ||
'abstract': False, | ||
'swappable': 'OAUTH2_PROVIDER_APPLICATION_MODEL', | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='AccessToken', | ||
fields=[ | ||
('id', models.BigAutoField(serialize=False, primary_key=True)), | ||
('token', models.CharField(unique=True, max_length=255)), | ||
('expires', models.DateTimeField()), | ||
('scope', models.TextField(blank=True)), | ||
('application', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=oauth2_settings.APPLICATION_MODEL)), | ||
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='oauth2_provider_accesstoken', to=settings.AUTH_USER_MODEL)), | ||
('created', models.DateTimeField(auto_now_add=True)), | ||
('updated', models.DateTimeField(auto_now=True)), | ||
# Circular reference. Can't add it here. | ||
#('source_refresh_token', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=oauth2_settings.REFRESH_TOKEN_MODEL, related_name="refreshed_access_token")), | ||
], | ||
options={ | ||
'abstract': False, | ||
'swappable': 'OAUTH2_PROVIDER_ACCESS_TOKEN_MODEL', | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='Grant', | ||
fields=[ | ||
('id', models.BigAutoField(serialize=False, primary_key=True)), | ||
('code', models.CharField(unique=True, max_length=255)), | ||
('expires', models.DateTimeField()), | ||
('redirect_uri', models.CharField(max_length=255)), | ||
('scope', models.TextField(blank=True)), | ||
('application', models.ForeignKey(to=oauth2_settings.APPLICATION_MODEL, on_delete=models.CASCADE)), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='oauth2_provider_grant', to=settings.AUTH_USER_MODEL)), | ||
('created', models.DateTimeField(auto_now_add=True)), | ||
('updated', models.DateTimeField(auto_now=True)), | ||
], | ||
options={ | ||
'abstract': False, | ||
'swappable': 'OAUTH2_PROVIDER_GRANT_MODEL', | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='RefreshToken', | ||
fields=[ | ||
('id', models.BigAutoField(serialize=False, primary_key=True)), | ||
('token', models.CharField(max_length=255)), | ||
('access_token', models.OneToOneField(blank=True, null=True, related_name="refresh_token", to=oauth2_settings.ACCESS_TOKEN_MODEL, on_delete=models.SET_NULL)), | ||
('application', models.ForeignKey(to=oauth2_settings.APPLICATION_MODEL, on_delete=models.CASCADE)), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='oauth2_provider_refreshtoken', to=settings.AUTH_USER_MODEL)), | ||
('created', models.DateTimeField(auto_now_add=True)), | ||
('updated', models.DateTimeField(auto_now=True)), | ||
('revoked', models.DateTimeField(null=True)), | ||
], | ||
options={ | ||
'abstract': False, | ||
'swappable': 'OAUTH2_PROVIDER_REFRESH_TOKEN_MODEL', | ||
'unique_together': set([("token", "revoked")]), | ||
}, | ||
), | ||
migrations.AddField( | ||
model_name='AccessToken', | ||
name='source_refresh_token', | ||
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=oauth2_settings.REFRESH_TOKEN_MODEL, related_name="refreshed_access_token"), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from oauth2_provider.settings import oauth2_settings | ||
from django.db import models, migrations | ||
import oauth2_provider.validators | ||
import oauth2_provider.generators | ||
from django.conf import settings | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('oauth2_provider', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='Application', | ||
name='skip_authorization', | ||
field=models.BooleanField(default=False), | ||
preserve_default=True, | ||
), | ||
migrations.AlterField( | ||
model_name='Application', | ||
name='user', | ||
field=models.ForeignKey(related_name='oauth2_provider_application', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE), | ||
preserve_default=True, | ||
), | ||
migrations.AlterField( | ||
model_name='AccessToken', | ||
name='user', | ||
field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE), | ||
preserve_default=True, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
from django.conf import settings | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('oauth2_provider', '0002_08_updates'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='application', | ||
name='user', | ||
field=models.ForeignKey(related_name='oauth2_provider_application', blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('oauth2_provider', '0003_auto_20160316_1503'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='accesstoken', | ||
name='token', | ||
field=models.CharField(unique=True, max_length=255), | ||
), | ||
migrations.AlterField( | ||
model_name='grant', | ||
name='code', | ||
field=models.CharField(unique=True, max_length=255), | ||
), | ||
migrations.AlterField( | ||
model_name='refreshtoken', | ||
name='token', | ||
field=models.CharField(unique=True, max_length=255), | ||
), | ||
] |
Oops, something went wrong.