Skip to content

Commit

Permalink
Merge pull request #414 from OpenIDC/413-response_mode_error
Browse files Browse the repository at this point in the history
Correctly create error response when wrong response_mode requested
  • Loading branch information
tpazderka authored Aug 25, 2017
2 parents 25a6fb8 + 6599086 commit 414e351
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ The format is based on the [KeepAChangeLog] project.
### Fixed
- [#405]: Fix generation of endpoint urls
- [#411]: Empty lists not indexable
- [#413]: Fix error when wrong response_mode requested

[#405]: https://github.com/OpenIDC/pyoidc/issues/405
[#413]: https://github.com/OpenIDC/pyoidc/issues/413

## 0.11.0.0 [2017-07-07]

Expand Down
2 changes: 1 addition & 1 deletion src/oic/oauth2/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ def _complete_authz(self, user, areq, sid, **kwargs):
redirect_uri=redirect_uri,
headers=headers)
except InvalidRequest as err:
return error("invalid_request", err)
return error("invalid_request", str(err))
else:
if resp is not None:
return resp
Expand Down
14 changes: 14 additions & 0 deletions tests/test_oauth2_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,20 @@ def test_authorization_endpoint_faulty_redirect_uri(self):
msg = json.loads(resp.message)
assert msg["error"] == "invalid_request"

def test_authorization_endpoint_wronge_response_mode(self):
bib = {"scope": ["openid"],
"state": "id-6da9ca0cc23959f5f33e8becd9b08cae",
"redirect_uri": "http://example.com",
"response_type": ["code"],
"response_mode": "fragment",
"client_id": "a1b2c3"}

arq = AuthorizationRequest(**bib)
resp = self.provider.authorization_endpoint(request=arq.to_urlencoded())
assert resp.status == "400 Bad Request"
msg = json.loads(resp.message)
assert msg["error"] == "invalid_request"

def test_authorization_endpoint_faulty_redirect_uri_nwalker(self):
bib = {"scope": ["openid"],
"state": "id-6da9ca0cc23959f5f33e8becd9b08cae",
Expand Down

0 comments on commit 414e351

Please sign in to comment.