Compare commits
3 Commits
cc4a9b9b91
...
56be90c84b
Author | SHA1 | Date |
---|---|---|
jorgepastorr | 56be90c84b | |
jorgepastorr | 5d905566c5 | |
jorgepastorr | 52f28872f8 |
|
@ -0,0 +1,47 @@
|
|||
Para añadir las modificaciones de esta rama hay que modificar el fichero panel/panel settings.py
|
||||
|
||||
Añadir modulo en:
|
||||
|
||||
INSTALLED_APPS = [
|
||||
...
|
||||
'oauth2_provider',
|
||||
]
|
||||
|
||||
seguido de la siguientes configuraciones:
|
||||
|
||||
MIDDLEWARE = (
|
||||
...
|
||||
#oauth
|
||||
'oauth2_provider.middleware.OAuth2TokenMiddleware',
|
||||
)
|
||||
|
||||
|
||||
AUTHENTICATION_BACKENDS = [
|
||||
...
|
||||
'oauth2_provider.backends.OAuth2Backend',
|
||||
]
|
||||
|
||||
|
||||
REST_FRAMEWORK = {
|
||||
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||
...
|
||||
'oauth2_provider.contrib.rest_framework.OAuth2Authentication',
|
||||
),
|
||||
}
|
||||
|
||||
OAUTH2_PROVIDER = {
|
||||
# this is the list of available scopes
|
||||
'SCOPES': {'read': 'Read scope', 'write': 'Write scope', 'groups': 'Access to your groups'}
|
||||
}
|
||||
|
||||
|
||||
Despues de assignar las anteriores configuraciones será necesario aplicar migrate
|
||||
|
||||
python3 manage.py migrate
|
||||
|
||||
---
|
||||
|
||||
Esta informacion se extrajo de:
|
||||
|
||||
- https://django-oauth-toolkit.readthedocs.io/en/latest/getting_started.html
|
||||
- https://django-oauth-toolkit.readthedocs.io/en/latest/rest-framework/rest-framework.html
|
|
@ -97,4 +97,5 @@ class OrchestraMenu(Menu):
|
|||
children=process_registry(administration)
|
||||
),
|
||||
items.MenuItem("API", api_link(context)),
|
||||
items.ModelList("oauth2", ["oauth2_provider.*"]),
|
||||
]
|
||||
|
|
|
@ -16,3 +16,11 @@ class AccountConfig(AppConfig):
|
|||
accounts.register(Account, icon='Face-monkey.png')
|
||||
post_migrate.connect(create_initial_superuser,
|
||||
dispatch_uid="orchestra.contrib.accounts.management.createsuperuser")
|
||||
|
||||
# from oauth2_provider.models import Grant, AccessToken, RefreshToken, IDToken, Application
|
||||
# accounts.register(Grant, dashboard=False)
|
||||
# accounts.register(AccessToken, parent=Grant, dashboard=False)
|
||||
# accounts.register(RefreshToken, parent=Grant, dashboard=False)
|
||||
# accounts.register(IDToken, parent=Grant, dashboard=False)
|
||||
# accounts.register(Application, parent=Grant, dashboard=False)
|
||||
|
||||
|
|
|
@ -161,6 +161,7 @@ class BackendOperation(models.Model):
|
|||
return ServiceBackend.get_backend(self.backend)
|
||||
|
||||
|
||||
def ready(self):
|
||||
autodiscover_modules('backends')
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 2.2.28 on 2023-09-14 15:49
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('websites', '0002_auto_20230817_1149'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='websitedirective',
|
||||
name='name',
|
||||
field=models.CharField(choices=[(None, '-------'), ('HTTPD', [('redirect', 'Redirection'), ('proxy', 'Proxy'), ('error-document', 'ErrorDocumentRoot')]), ('SSL', [('ssl-ca', 'SSL CA'), ('ssl-cert', 'SSL cert'), ('ssl-key', 'SSL key')]), ('ModSecurity', [('sec-rule-remove', 'SecRuleRemoveById'), ('sec-engine', 'SecRuleEngine Off')]), ('SaaS', [('wordpress-saas', 'WordPress SaaS')])], db_index=True, max_length=128, verbose_name='name'),
|
||||
),
|
||||
]
|
|
@ -22,6 +22,8 @@ urlpatterns = [
|
|||
url(r'^api-token-auth/', obtain_auth_token, name='api-token-auth'),
|
||||
url(r'^media/(.+)/(.+)/(.+)/(.+)/(.+)$', serve_private_media, name='private-media'),
|
||||
# url(r'search', 'orchestra.views.search', name='search'),
|
||||
# OAUTH
|
||||
url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
|
||||
]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue