Skip to content

Commit

Permalink
Fix creation of error on client registration
Browse files Browse the repository at this point in the history
Close #449
  • Loading branch information
tpazderka committed Dec 7, 2017
1 parent a0dcac0 commit 691fb22
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ The format is based on the [KeepAChangeLog] project.
- [#399] Matching response_types for authz requests is too strict
- [#436] Fixed client.read_registration
- [#446] Fixed provider.read_registration
- [#449] Fixed creation of error_response on client registration

[#430]: https://github.com/OpenIDC/pyoidc/pull/430
[#427]: https://github.com/OpenIDC/pyoidc/pull/427
[#399]: https://github.com/OpenIDC/pyoidc/issues/399
[#436]: https://github.com/OpenIDC/pyoidc/pull/436
[#443]: https://github.com/OpenIDC/pyoidc/pull/443
[#446]: https://github.com/OpenIDC/pyoidc/issues/446
[#449]: https://github.com/OpenIDC/pyoidc/issues/449

## 0.12.0 [2017-09-25]

Expand Down
2 changes: 1 addition & 1 deletion src/oic/oic/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ def do_client_registration(self, request, client_id, ignore=None):
try:
_cinfo["si_redirects"], _cinfo["sector_id"] = self._verify_sector_identifier(request)
except InvalidSectorIdentifier as err:
return error_response("invalid_configuration_parameter", descr=err)
return error_response("invalid_configuration_parameter", descr=str(err))
elif "redirect_uris" in request:
if len(request["redirect_uris"]) > 1:
# check that the hostnames are the same
Expand Down
12 changes: 12 additions & 0 deletions tests/test_oic_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,18 @@ def test_registration_endpoint_unicode(self):
'client_id', 'client_secret',
'client_id_issued_at', 'response_types'])

def test_do_client_registration_invalid_sector_uri(self):
rr = RegistrationRequest(operation='register', sector_identifier_uri='https://example.com',
redirect_uris=['http://example.com/changed'])
redirects = ['http://example.com/present']
with responses.RequestsMock() as rsps:
rsps.add(rsps.GET, 'https://example.com', body=json.dumps(redirects))
resp = self.provider.do_client_registration(rr, 'client0')

assert resp.status == '400 Bad Request'
error = json.loads(resp.message)
assert error['error'] == 'invalid_configuration_parameter'

def test_registration_endpoint_with_non_https_redirect_uri_implicit_flow(
self):
params = {"application_type": "web",
Expand Down

0 comments on commit 691fb22

Please sign in to comment.