Skip to content

Commit

Permalink
Fix generation of endpoint urls
Browse files Browse the repository at this point in the history
Close #405
  • Loading branch information
tpazderka committed Aug 11, 2017
1 parent 58a8097 commit dddd054
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ The format is based on the [KeepAChangeLog] project.

[KeepAChangeLog]: http://keepachangelog.com/

## 0.11.1.0 [Unreleased]

This comment has been minimized.

Copy link
@schlenk

schlenk Aug 15, 2017

Collaborator

Why add a number and not just [Unreleased] and we decide about the version number when we do the next release?

This comment has been minimized.

Copy link
@tpazderka

tpazderka Aug 15, 2017

Author Collaborator

We can always change it... This line has to be edited anyways.


### Fixed
- [#405]: Fix generation of endpoint urls

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

## 0.11.0.0 [2017-07-07]

### Changed
Expand Down
8 changes: 5 additions & 3 deletions src/oic/oic/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -1663,9 +1663,11 @@ def create_providerinfo(self, pcr_class=ProviderConfigurationResponse,

for endp in self.endp:
# _log_info("# %s, %s" % (endp, endp.name))
_provider_info['{}_endpoint'.format(endp.etype)] = '{}/{}'.format(
self.baseurl,
endp.url)
if not self.baseurl.endswith('/'):
baseurl = self.baseurl + '/'
else:
baseurl = self.baseurl
_provider_info['{}_endpoint'.format(endp.etype)] = urljoin(baseurl, endp.url)

if setup and isinstance(setup, dict):
for key in pcr_class.c_param.keys():
Expand Down
10 changes: 10 additions & 0 deletions tests/test_oic_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,16 @@ def create_provider(self, session_db_factory):
"request_object_signing_alg": DEF_SIGN_ALG["openid_request_object"]}
self.cons.keyjar[""] = KC_RSA

def test_providerinfo(self):
self.provider.baseurl = 'http://example.com/path1/path2'
resp = self.provider.create_providerinfo()
assert resp.to_dict()['authorization_endpoint'] == 'http://example.com/path1/path2/authorization'

def test_providerinfo_trailing(self):
self.provider.baseurl = 'http://example.com/path1/path2/'
resp = self.provider.create_providerinfo()
assert resp.to_dict()['authorization_endpoint'] == 'http://example.com/path1/path2/authorization'

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

0 comments on commit dddd054

Please sign in to comment.