Projet

Général

Profil

« Précédent | Suivant » 

Révision bdff7b72

Ajouté par Jérôme Schneider il y a plus de 9 ans

saml2: simplify local logout

Voir les différences:

mandaye/auth/saml2.py
26 26

  
27 27
Optional options :
28 28
 * saml2_sp_logout_url: the url to logout the service provider
29
 * saml2_sp_logout_method: GET or POST
30 29
 * saml2_authnresp_binding: only post is supported for now
31 30
 * saml2_authnreq_http_method: only http_redirect at the moment
32 31
 * saml2_name_identifier_format: only persistent at the moment
......
68 67
                'saml2_signature_public_key': public_key,
69 68
                'saml2_signature_private_key': private_key,
70 69
                'saml2_sp_logout_url': self.env['mandaye.config'].get('saml2_sp_logout_url'),
71
                'saml2_sp_logout_method': 'GET',
72 70
                'saml2_authnresp_binding': lasso.SAML2_METADATA_BINDING_POST,
73 71
                'saml2_authnreq_http_method': lasso.HTTP_METHOD_REDIRECT,
74 72
                'saml2_name_identifier_format': lasso.SAML2_NAME_IDENTIFIER_FORMAT_PERSISTENT
......
135 133
                return _302(next_url, req_cookies)
136 134
            else:
137 135
                return _302('/', req_cookies)
138
        if self.config['saml2_sp_logout_method'] == 'POST':
139
            headers = HTTPHeader({'Content-Type': ['application/x-www-form-urlencoded']})
140
        else:
141
            headers = HTTPHeader()
142
        request = HTTPRequest(req_cookies, headers, self.config['saml2_sp_logout_method'])
143
        response = get_response(env, request, self.config['saml2_sp_logout_url'])
144
        if next_url:
145
            return _302(next_url, response.cookies)
146
        else:
147
            return response
136
        return _302(self.config['saml2_sp_logout_url'], req_cookies)
148 137

  
149 138
    def _get_idp_metadata_file_path(self):
150 139
        metadata_file_path = None

Formats disponibles : Unified diff