add audience field, switch base processor, better handle processor loading failure
This commit is contained in:
parent
98cd646044
commit
9f8fb7378a
|
@ -116,11 +116,7 @@ class Processor:
|
||||||
|
|
||||||
def _determine_audience(self):
|
def _determine_audience(self):
|
||||||
"""Determines the _audience."""
|
"""Determines the _audience."""
|
||||||
self._audience = self._request_params.get('DESTINATION', None)
|
self._audience = self._remote.audience
|
||||||
|
|
||||||
if not self._audience:
|
|
||||||
self._audience = self._request_params.get('PROVIDER_NAME', None)
|
|
||||||
|
|
||||||
self._logger.info('determined audience')
|
self._logger.info('determined audience')
|
||||||
|
|
||||||
def _determine_response_id(self):
|
def _determine_response_id(self):
|
||||||
|
|
|
@ -25,7 +25,7 @@ class SAMLProviderForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
||||||
model = SAMLProvider
|
model = SAMLProvider
|
||||||
fields = ['name', 'property_mappings', 'acs_url', 'processor_path', 'issuer',
|
fields = ['name', 'property_mappings', 'acs_url', 'audience', 'processor_path', 'issuer',
|
||||||
'assertion_valid_for', 'signing', 'signing_cert', 'signing_key', ]
|
'assertion_valid_for', 'signing', 'signing_cert', 'signing_key', ]
|
||||||
labels = {
|
labels = {
|
||||||
'acs_url': 'ACS URL',
|
'acs_url': 'ACS URL',
|
||||||
|
@ -33,6 +33,7 @@ class SAMLProviderForm(forms.ModelForm):
|
||||||
}
|
}
|
||||||
widgets = {
|
widgets = {
|
||||||
'name': forms.TextInput(),
|
'name': forms.TextInput(),
|
||||||
|
'audience': forms.TextInput(),
|
||||||
'issuer': forms.TextInput(),
|
'issuer': forms.TextInput(),
|
||||||
'property_mappings': FilteredSelectMultiple(_('Property Mappings'), False)
|
'property_mappings': FilteredSelectMultiple(_('Property Mappings'), False)
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 2.2 on 2019-04-18 09:09
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('passbook_saml_idp', '0002_samlpropertymapping'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='samlprovider',
|
||||||
|
name='audience',
|
||||||
|
field=models.TextField(blank=True, default=''),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 2.2 on 2019-04-18 09:18
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('passbook_saml_idp', '0003_samlprovider_audience'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='samlprovider',
|
||||||
|
name='audience',
|
||||||
|
field=models.TextField(default=''),
|
||||||
|
),
|
||||||
|
]
|
|
@ -15,6 +15,7 @@ class SAMLProvider(Provider):
|
||||||
|
|
||||||
name = models.TextField()
|
name = models.TextField()
|
||||||
acs_url = models.URLField()
|
acs_url = models.URLField()
|
||||||
|
audience = models.TextField(default='')
|
||||||
processor_path = models.CharField(max_length=255, choices=[])
|
processor_path = models.CharField(max_length=255, choices=[])
|
||||||
issuer = models.TextField()
|
issuer = models.TextField()
|
||||||
assertion_valid_for = models.IntegerField(default=86400)
|
assertion_valid_for = models.IntegerField(default=86400)
|
||||||
|
@ -33,7 +34,10 @@ class SAMLProvider(Provider):
|
||||||
def processor(self):
|
def processor(self):
|
||||||
"""Return selected processor as instance"""
|
"""Return selected processor as instance"""
|
||||||
if not self._processor:
|
if not self._processor:
|
||||||
self._processor = path_to_class(self.processor_path)(self)
|
try:
|
||||||
|
self._processor = path_to_class(self.processor_path)(self)
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
self._processor = None
|
||||||
return self._processor
|
return self._processor
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
Reference in New Issue