Projet

Général

Profil

0001-idp_oidc-fix-MissingParameter-initialization-50217.patch

Serghei Mihai (congés, retour 15/05), 18 janvier 2021 11:01

Télécharger (2,29 ko)

Voir les différences:

Subject: [PATCH] idp_oidc: fix MissingParameter initialization (#50217)

 src/authentic2_idp_oidc/views.py |  4 ++--
 tests/test_idp_oidc.py           | 13 ++++++++++---
 2 files changed, 12 insertions(+), 5 deletions(-)
src/authentic2_idp_oidc/views.py
128 128

  
129 129

  
130 130
class MissingParameter(InvalidRequest):
131
    def __init__(self, parameter):
132
        super().__init__(error_description=_('Missing parameter "%s"') % parameter)
131
    def __init__(self, parameter, **kwargs):
132
        super().__init__(error_description=_('Missing parameter "%s"') % parameter, **kwargs)
133 133

  
134 134

  
135 135
class UnsupportedResponseType(OIDCException):
tests/test_idp_oidc.py
778 778
        assert query['code'] == [code.uuid]
779 779
        code = query['code'][0]
780 780
        token_url = make_url('oidc-token')
781
        response = app.post(token_url, params={
781
        params = {
782 782
            'grant_type': 'authorization_code',
783
            'code': code,
784 783
            'redirect_uri': oidc_client.redirect_uris.split()[0],
785
        }, headers=client_authentication_headers(oidc_client), status=400)
784
        }
785
        response = app.post(token_url, params=params,
786
                            headers=client_authentication_headers(oidc_client), status=400)
787
        assert response.json['error'] == 'invalid_request'
788
        assert response.json['error_description'] == 'Missing parameter "code"'
789

  
790
        params['code'] = code
791
        response = app.post(token_url, params=params,
792
                            headers=client_authentication_headers(oidc_client), status=400)
786 793
        assert 'error' in response.json
787 794
        assert response.json['error'] == 'invalid_request'
788 795
        assert response.json['error_description'] == 'Parameter "code" has expired or user is disconnected'
789
-