Compare commits

..

No commits in common. "56be90c84b79533d945bf4eb462a7addc4d81b78" and "cc4a9b9b91e451919e4064e38832219c95630065" have entirely different histories.

6 changed files with 1 additions and 78 deletions

View File

@ -1,47 +0,0 @@
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

View File

@ -97,5 +97,4 @@ class OrchestraMenu(Menu):
children=process_registry(administration)
),
items.MenuItem("API", api_link(context)),
items.ModelList("oauth2", ["oauth2_provider.*"]),
]

View File

@ -16,11 +16,3 @@ 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)

View File

@ -161,8 +161,7 @@ class BackendOperation(models.Model):
return ServiceBackend.get_backend(self.backend)
def ready(self):
autodiscover_modules('backends')
autodiscover_modules('backends')
class RouteQuerySet(models.QuerySet):

View File

@ -1,18 +0,0 @@
# 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'),
),
]

View File

@ -22,8 +22,6 @@ 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')),
]