Projet

Général

Profil

0001-remove-authentic2_idp_oidc-from-plugin-system-44331.patch

Emmanuel Cazenave, 23 juin 2020 12:33

Télécharger (4,75 ko)

Voir les différences:

Subject: [PATCH] remove authentic2_idp_oidc from plugin system (#44331)

 setup.py                            |  1 -
 src/authentic2/settings.py          |  1 +
 src/authentic2/urls.py              |  2 ++
 src/authentic2_idp_oidc/__init__.py | 32 -----------------------------
 src/authentic2_idp_oidc/apps.py     | 22 ++++++++++++++++++++
 5 files changed, 25 insertions(+), 33 deletions(-)
setup.py
169 169
      },
170 170
      entry_points={
171 171
          'authentic2.plugin': [
172
              'authentic2-idp-oidc = authentic2_idp_oidc:Plugin',
173 172
              'authentic2-provisionning-ldap = authentic2_provisionning_ldap:Plugin',
174 173
              'authentic2-auth-fc = authentic2_auth_fc:Plugin',
175 174
          ],
src/authentic2/settings.py
132 132
    'authentic2_auth_saml',
133 133
    'authentic2_auth_oidc',
134 134
    'authentic2_idp_cas',
135
    'authentic2_idp_oidc',
135 136
    'authentic2.nonce',
136 137
    'authentic2.saml',
137 138
    'authentic2.idp',
src/authentic2/urls.py
28 28
import authentic2_auth_oidc.urls
29 29
import authentic2_auth_saml.urls
30 30
import authentic2_idp_cas.app_settings
31
import authentic2_idp_oidc.urls
31 32
import authentic2.idp.saml.app_settings
32 33

  
33 34

  
......
167 168
)
168 169

  
169 170
urlpatterns = (
171
    authentic2_idp_oidc.urls.urlpatterns +
170 172
    authentic2_idp_cas_urls +
171 173
    authentic2_auth_oidc.urls.urlpatterns +
172 174
    authentic2_auth_saml.urls.urlpatterns +
src/authentic2_idp_oidc/__init__.py
14 14
# You should have received a copy of the GNU Affero General Public License
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17
from django.template.loader import render_to_string
18

  
19 17
default_app_config = 'authentic2_idp_oidc.apps.AppConfig'
20

  
21

  
22
class Plugin(object):
23
    def get_before_urls(self):
24
        from . import urls
25
        return urls.urlpatterns
26

  
27
    def get_apps(self):
28
        return [__name__]
29

  
30
    def logout_list(self, request):
31
        from .utils import get_oidc_sessions
32
        from . import app_settings
33

  
34
        fragments = []
35

  
36
        oidc_sessions = get_oidc_sessions(request)
37
        for key, value in oidc_sessions.items():
38
            if 'frontchannel_logout_uri' not in value:
39
                continue
40
            ctx = {
41
                'url': value['frontchannel_logout_uri'],
42
                'name': value['name'],
43
                'iframe_timeout': value.get('frontchannel_timeout') or app_settings.DEFAULT_FRONTCHANNEL_TIMEOUT,
44
            }
45
            fragments.append(
46
                render_to_string(
47
                    'authentic2_idp_oidc/logout_fragment.html',
48
                    ctx))
49
        return fragments
src/authentic2_idp_oidc/apps.py
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17 17
import django.apps
18
from django.template.loader import render_to_string
18 19
from django.utils.encoding import smart_bytes
19 20

  
20 21

  
......
127 128
            qs = qs.distinct()
128 129

  
129 130
            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
130
-