diff --git a/passbook/core/apps.py b/passbook/core/apps.py index 3748c1e82..a33bc9f7f 100644 --- a/passbook/core/apps.py +++ b/passbook/core/apps.py @@ -7,3 +7,4 @@ class PassbookCoreConfig(AppConfig): name = 'passbook.core' label = 'passbook_core' + verbose_name = 'passbook Core' diff --git a/passbook/core/settings.py b/passbook/core/settings.py index 557acda5e..71a20b539 100644 --- a/passbook/core/settings.py +++ b/passbook/core/settings.py @@ -32,7 +32,7 @@ SECRET_KEY = '9$@r!d^1^jrn#fk#1#@ks#9&i$^s#1)_13%$rwjrhd=e8jfi_s' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True INTERNAL_IPS = ['127.0.0.1'] -ALLOWED_HOSTS = ['172.16.16.100'] +ALLOWED_HOSTS = [] LOGIN_URL = 'passbook_core:auth-login' diff --git a/passbook/oauth_provider/apps.py b/passbook/oauth_provider/apps.py index 481567552..d29c696fc 100644 --- a/passbook/oauth_provider/apps.py +++ b/passbook/oauth_provider/apps.py @@ -8,4 +8,5 @@ class PassbookOAuthProviderConfig(AppConfig): name = 'passbook.oauth_provider' label = 'passbook_oauth_provider' + verbose_name = 'passbook OAuth Provider' mountpoint = 'application/oauth/' diff --git a/passbook/oauth_provider/migrations/0002_auto_20181126_1514.py b/passbook/oauth_provider/migrations/0002_auto_20181126_1514.py new file mode 100644 index 000000000..ec85f7878 --- /dev/null +++ b/passbook/oauth_provider/migrations/0002_auto_20181126_1514.py @@ -0,0 +1,17 @@ +# Generated by Django 2.1.3 on 2018-11-26 15:14 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('passbook_oauth_provider', '0001_initial'), + ] + + operations = [ + migrations.AlterModelOptions( + name='oauth2provider', + options={'verbose_name': 'OAuth2 Provider', 'verbose_name_plural': 'OAuth2 Providers'}, + ), + ] diff --git a/passbook/oauth_provider/models.py b/passbook/oauth_provider/models.py index 79c46b72d..6cb224beb 100644 --- a/passbook/oauth_provider/models.py +++ b/passbook/oauth_provider/models.py @@ -3,6 +3,7 @@ from oauth2_provider.models import AbstractApplication from passbook.core.models import Provider +from django.utils.translation import gettext as _ class OAuth2Provider(Provider, AbstractApplication): @@ -10,3 +11,8 @@ class OAuth2Provider(Provider, AbstractApplication): def __str__(self): return self.name + + class Meta: + + verbose_name = _('OAuth2 Provider') + verbose_name_plural = _('OAuth2 Providers') diff --git a/passbook/saml_idp/migrations/0002_auto_20181126_1509.py b/passbook/saml_idp/migrations/0002_auto_20181126_1509.py new file mode 100644 index 000000000..9e4349ac2 --- /dev/null +++ b/passbook/saml_idp/migrations/0002_auto_20181126_1509.py @@ -0,0 +1,32 @@ +# Generated by Django 2.1.3 on 2018-11-26 15:09 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('passbook_core', '0003_rule_order'), + ('passbook_saml_idp', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='SAMLProvider', + fields=[ + ('provider_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='passbook_core.Provider')), + ('name', models.TextField()), + ('acs_url', models.URLField()), + ('processor_path', models.CharField(max_length=255)), + ], + bases=('passbook_core.provider',), + ), + migrations.RemoveField( + model_name='samlapplication', + name='application_ptr', + ), + migrations.DeleteModel( + name='SAMLApplication', + ), + ] diff --git a/passbook/saml_idp/migrations/0003_auto_20181126_1514.py b/passbook/saml_idp/migrations/0003_auto_20181126_1514.py new file mode 100644 index 000000000..d37378067 --- /dev/null +++ b/passbook/saml_idp/migrations/0003_auto_20181126_1514.py @@ -0,0 +1,17 @@ +# Generated by Django 2.1.3 on 2018-11-26 15:14 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('passbook_saml_idp', '0002_auto_20181126_1509'), + ] + + operations = [ + migrations.AlterModelOptions( + name='samlprovider', + options={'verbose_name': 'SAML Provider', 'verbose_name_plural': 'SAML Providers'}, + ), + ] diff --git a/passbook/saml_idp/models.py b/passbook/saml_idp/models.py index 15b46d889..9d3a0b4ae 100644 --- a/passbook/saml_idp/models.py +++ b/passbook/saml_idp/models.py @@ -2,14 +2,16 @@ from django.db import models -from passbook.core.models import Application +from passbook.core.models import Provider from passbook.lib.utils.reflection import class_to_path from passbook.saml_idp.base import Processor +from django.utils.translation import gettext as _ -class SAMLApplication(Application): +class SAMLProvider(Provider): """Model to save information about a Remote SAML Endpoint""" + name = models.TextField() acs_url = models.URLField() processor_path = models.CharField(max_length=255, choices=[]) @@ -19,7 +21,9 @@ class SAMLApplication(Application): self._meta.get_field('processor_path').choices = processors def __str__(self): - return "SAMLApplication %s (processor=%s)" % (self.name, self.processor_path) + return "SAMLProvider %s (processor=%s)" % (self.name, self.processor_path) - def user_is_authorized(self): - raise NotImplementedError() + class Meta: + + verbose_name = _('SAML Provider') + verbose_name_plural = _('SAML Providers') diff --git a/passbook/saml_idp/registry.py b/passbook/saml_idp/registry.py index b283070b8..99caed9f8 100644 --- a/passbook/saml_idp/registry.py +++ b/passbook/saml_idp/registry.py @@ -3,7 +3,7 @@ from logging import getLogger from passbook.lib.utils.reflection import path_to_class from passbook.saml_idp.exceptions import CannotHandleAssertion -from passbook.saml_idp.models import SAMLApplication +from passbook.saml_idp.models import SAMLProvider LOGGER = getLogger(__name__) @@ -16,7 +16,7 @@ def get_processor(remote): def find_processor(request): """Returns the Processor instance that is willing to handle this request.""" - for remote in SAMLApplication.objects.all(): + for remote in SAMLProvider.objects.all(): proc = get_processor(remote) try: if proc.can_handle(request):