0002-idp.saml-rely-on-get_plugins-for-beeing-discovered-4.patch
src/authentic2/cors.py | ||
---|---|---|
58 | 58 |
for whitelist_origin in app_settings.A2_CORS_WHITELIST: |
59 | 59 |
if whitelist_origin == origin: |
60 | 60 |
return True |
61 |
for plugin in itertools.chain(plugins.get_plugins(), apps.get_app_configs()):
|
|
61 |
for plugin in plugins.get_plugins():
|
|
62 | 62 |
if hasattr(plugin, 'check_origin'): |
63 | 63 |
if plugin.check_origin(request, origin): |
64 | 64 |
return True |
src/authentic2/idp/saml/__init__.py | ||
---|---|---|
19 | 19 |
from django.apps import AppConfig |
20 | 20 | |
21 | 21 | |
22 |
class SAML2IdPConfig(AppConfig): |
|
23 |
name = 'authentic2.idp.saml' |
|
24 |
label = 'authentic2_idp_saml' |
|
22 |
class Plugin(object): |
|
25 | 23 | |
26 | 24 |
def check_origin(self, request, origin): |
27 | 25 |
from authentic2.cors import make_origin |
... | ... | |
32 | 30 |
if origin == provider_origin: |
33 | 31 |
return True |
34 | 32 | |
33 | ||
34 |
class SAML2IdPConfig(AppConfig): |
|
35 |
name = 'authentic2.idp.saml' |
|
36 |
label = 'authentic2_idp_saml' |
|
37 | ||
38 |
def get_a2_plugin(self): |
|
39 |
return Plugin() |
|
40 | ||
41 | ||
35 | 42 |
default_app_config = 'authentic2.idp.saml.SAML2IdPConfig' |
36 | 43 | |
37 | 44 | |
38 |
- |