Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on the [KeepAChangeLog] project.
## 0.14.0 [2018-05-15]

### Fixed
- [#553] Made sure a a reload would not lead to duplicated keys in a keybundle.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be in the 0.14.0 section.

Open a new section for still unreleased changes on top.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it

- [#534] Fixed a bug in client_secret_basic authentication
- [#503] Fix error on UserInfo endpoint for removed clients
- [#508] JWT now uses verify keys for JWT verification
Expand Down Expand Up @@ -45,6 +46,7 @@ The format is based on the [KeepAChangeLog] project.
[#532]: https://github.com/OpenIDC/pyoidc/pull/532
[#498]: https://github.com/OpenIDC/pyoidc/issues/498
[#534]: https://github.com/OpenIDC/pyoidc/pull/534
[#553]: https://github.com/OpenIDC/pyoidc/pull/553
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above, move to new section preparing for 0.15.0


## 0.13.1 [2018-04-06]

Expand Down
7 changes: 4 additions & 3 deletions src/oic/utils/keyio.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@ def do_keys(self, keys):
except JWKException as err:
logger.warning('Loading a key failed: %s', err)
else:
self._keys.append(_key)
flag = 1
break
if _key not in self._keys:
self._keys.append(_key)
flag = 1
break
if not flag:
logger.warning('Unknown key type: %s', typ)

Expand Down
25 changes: 25 additions & 0 deletions tests/test_keyio.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,3 +575,28 @@ def test_load_spomky_keys():
kj = KeyJar()
kj.import_jwks(JWKS_SPO, '')
assert len(kj.get_issuer_keys('')) == 4


def test_reload():
"""
Emulates what happens if you fetch keys from a remote site and
you get back the same JWKS as the last time.
"""
_jwks = {
"keys": [
{
"alg":"RS256",
"e":"AQAB",
"kty":"RSA",
"n":"wkpyitec6TgFC5G41RF6jBOZghGVyaHL79CzSjjS9VCkWjpGo2hajOsiJ1RnSoat9XDmQAqiqn18rWx4xa4ErdWVqug88pLxMVmnV9tF10uJNgIi_RSsIQz40J9aKrxOotN6Mnq454BpanAxbrbC5hLlp-PIGgmWzUDNwCSfnWBjd0yGwdYKVB6d-SGNfLvdMUhFiYIX0POUnJDNl_j3kLYQ0peYRbunyQzST5nLPOItePCuZ12G5e0Eo1meSF1Md3IkuY8paqKk-vsWrT22X7CUV3HZow06ogRcFMMzvooE7yDqS53I_onsUrqgQ2aUnoo8OaD0eLlEWdaTyeNAIw","use":"sig"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put the jwks in an extra file or make pylama happy about the overlong lines.

}]}

kb = KeyBundle()
kb.imp_jwks = _jwks
kb.do_keys(kb.imp_jwks['keys'])

assert len(kb) == 1

kb.do_keys(kb.imp_jwks['keys'])

assert len(kb) == 1