Fixup verbose names
This commit is contained in:
parent
ca80ebc0cc
commit
15ed14046e
|
@ -7,3 +7,4 @@ class PassbookCoreConfig(AppConfig):
|
|||
|
||||
name = 'passbook.core'
|
||||
label = 'passbook_core'
|
||||
verbose_name = 'passbook Core'
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
|
@ -8,4 +8,5 @@ class PassbookOAuthProviderConfig(AppConfig):
|
|||
|
||||
name = 'passbook.oauth_provider'
|
||||
label = 'passbook_oauth_provider'
|
||||
verbose_name = 'passbook OAuth Provider'
|
||||
mountpoint = 'application/oauth/'
|
||||
|
|
|
@ -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'},
|
||||
),
|
||||
]
|
|
@ -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')
|
||||
|
|
|
@ -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',
|
||||
),
|
||||
]
|
|
@ -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'},
|
||||
),
|
||||
]
|
|
@ -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')
|
||||
|
|
|
@ -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):
|
||||
|
|
Reference in New Issue