0005-authentic2_idp_oidc-rely-on-get_plugins-for-beeing-d.patch
src/authentic2_idp_oidc/apps.py | ||
---|---|---|
19 | 19 |
from django.utils.encoding import smart_bytes |
20 | 20 | |
21 | 21 | |
22 |
class Plugin(object): |
|
23 | ||
24 |
def logout_list(self, request): |
|
25 |
from .utils import get_oidc_sessions |
|
26 |
from . import app_settings |
|
27 | ||
28 |
fragments = [] |
|
29 | ||
30 |
oidc_sessions = get_oidc_sessions(request) |
|
31 |
for key, value in oidc_sessions.items(): |
|
32 |
if 'frontchannel_logout_uri' not in value: |
|
33 |
continue |
|
34 |
ctx = { |
|
35 |
'url': value['frontchannel_logout_uri'], |
|
36 |
'name': value['name'], |
|
37 |
'iframe_timeout': value.get('frontchannel_timeout') or app_settings.DEFAULT_FRONTCHANNEL_TIMEOUT, |
|
38 |
} |
|
39 |
fragments.append( |
|
40 |
render_to_string( |
|
41 |
'authentic2_idp_oidc/logout_fragment.html', |
|
42 |
ctx)) |
|
43 |
return fragments |
|
44 | ||
45 | ||
22 | 46 |
class AppConfig(django.apps.AppConfig): |
23 | 47 |
name = 'authentic2_idp_oidc' |
24 | 48 | |
49 |
def get_a2_plugin(self): |
|
50 |
return Plugin() |
|
51 | ||
52 | ||
25 | 53 |
# implement translation of encrypted pairwise identifiers when and OIDC Client is using the |
26 | 54 |
# A2 API |
27 | 55 |
def a2_hook_api_modify_serializer(self, view, serializer): |
... | ... | |
128 | 156 |
qs = qs.distinct() |
129 | 157 | |
130 | 158 |
return qs |
131 | ||
132 |
def logout_list(self, request): |
|
133 |
from .utils import get_oidc_sessions |
|
134 |
from . import app_settings |
|
135 | ||
136 |
fragments = [] |
|
137 | ||
138 |
oidc_sessions = get_oidc_sessions(request) |
|
139 |
for key, value in oidc_sessions.items(): |
|
140 |
if 'frontchannel_logout_uri' not in value: |
|
141 |
continue |
|
142 |
ctx = { |
|
143 |
'url': value['frontchannel_logout_uri'], |
|
144 |
'name': value['name'], |
|
145 |
'iframe_timeout': value.get('frontchannel_timeout') or app_settings.DEFAULT_FRONTCHANNEL_TIMEOUT, |
|
146 |
} |
|
147 |
fragments.append( |
|
148 |
render_to_string( |
|
149 |
'authentic2_idp_oidc/logout_fragment.html', |
|
150 |
ctx)) |
|
151 |
return fragments |
|
152 |
- |