Skip to content

Distributed claims#420

Merged
tpazderka merged 6 commits intoCZ-NIC:masterfrom
rohe:distributed_claims
Sep 15, 2017
Merged

Distributed claims#420
tpazderka merged 6 commits intoCZ-NIC:masterfrom
rohe:distributed_claims

Conversation

@rohe
Copy link
Contributor

@rohe rohe commented Sep 4, 2017

Fixed bug in handling of distributed claims.

Thanks for contributing to this library! Please include the following check
list in your pull request submission (you can delete this message). If your
changes don't need a change log or documentation update, please ignore this.

  • Any changes relevant to users are recorded in the CHANGELOG.md.
  • The documentation has been updated, if necessary.

@coveralls
Copy link

coveralls commented Sep 4, 2017

Coverage Status

Coverage increased (+0.1%) to 59.937% when pulling 43e0a77 on rohe:distributed_claims into f220947 on OpenIDC:master.

@coveralls
Copy link

coveralls commented Sep 4, 2017

Coverage Status

Coverage increased (+0.1%) to 59.937% when pulling 007244d on rohe:distributed_claims into f220947 on OpenIDC:master.

_uinfo = self.do_user_info_request(
token=callback(csrc),
userinfo_endpoint=spec["endpoint"])
if callback:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This part is not covered by tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does the recent changes meet your requirements ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry for not responding earlier. I am having a busy week at work. I will have a look today.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Here again, comparison to None and test without callback is missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK now ? Need to get this out the door soon.

if 'as_query_parameter' == _behav:
method = 'GET'
else:
elif token:
Copy link
Collaborator

Choose a reason for hiding this comment

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

  • Comparison to None should be explicit.
  • In tests, this condition is always true, so a test with token = None should be added.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The comparison is still not explicit. It believe that it should be elif token is not None: as token is previously assigned None.

Copy link
Contributor Author

@rohe rohe Sep 10, 2017

Choose a reason for hiding this comment

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

I don't think that is good enough. token='' should be handled the same way as token=None
hence the use of elif token which implicitly include token is not ''.
And I'd rather not use elif token is not None and token is not ''

Copy link
Collaborator

Choose a reason for hiding this comment

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

And is there any case where token would be an empty string?
If yes, then OK, leave the code as is.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 60.012% when pulling eed4b70 on rohe:distributed_claims into f220947 on OpenIDC:master.

@coveralls
Copy link

coveralls commented Sep 6, 2017

Coverage Status

Coverage increased (+0.3%) to 60.088% when pulling eed4b70 on rohe:distributed_claims into f220947 on OpenIDC:master.

_ttype = token.token_type
except AttributeError:
raise MissingParameter("Unspecified token type")
if token:
Copy link
Collaborator

Choose a reason for hiding this comment

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

The same goes here: if token is not None:

if state:
# Verify userinfo sub claim against what's returned in the ID Token
idt = self.grant[state].get_id_token()
if idt:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems to never be triggered in tests.

@tpazderka
Copy link
Collaborator

I know this is a lot of tests to be added, but if you are already poking into the code, we might as well add test to cover the changes...

@coveralls
Copy link

coveralls commented Sep 10, 2017

Coverage Status

Coverage increased (+0.3%) to 60.114% when pulling 323f074 on rohe:distributed_claims into f220947 on OpenIDC:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 60.114% when pulling 323f074 on rohe:distributed_claims into f220947 on OpenIDC:master.

@coveralls
Copy link

coveralls commented Sep 11, 2017

Coverage Status

Coverage increased (+0.3%) to 60.114% when pulling 1013ede on rohe:distributed_claims into f220947 on OpenIDC:master.

@tpazderka
Copy link
Collaborator

I would like to see more tests, but I understand that any progress is better than none.

@decentral1se
Copy link
Contributor

I would like to see more tests, but I understand that any progress is better than none.

Agreed!

If we feel like we're missing coverage, just create an issue with a link to this PR and we can track that. If a bug is ever raised, we will be motivated to come back to cover the remaining cases.

Nice work @rohe.

@rohe
Copy link
Contributor Author

rohe commented Sep 15, 2017

Sounds good to me.
So, can one of you merge the PR.
Since I'm the author I shouldn't do it myself.
After the merge I'd like us to release a new version to pypi.
The next release of the OpenID Connect tool has a dependency on this PR and I want to get that out the door as soon as possible.

@tpazderka tpazderka merged commit d840b0b into CZ-NIC:master Sep 15, 2017
@decentral1se
Copy link
Contributor

🍰

Since I'm the author I shouldn't do it myself.

Hey, you may be VIP but you're not getting out of merging your own PRs ;)

I won't get time to make a release, please someone, go for it and keep #419 in mind.

@rohe
Copy link
Contributor Author

rohe commented Sep 15, 2017

Excellent new! Thanks !
VIP, lol :-)
I'll probably not have time to do a release today. At the earliest tomorrow afternoon.

@rohe rohe deleted the distributed_claims branch September 15, 2017 10:31
andrewkrug pushed a commit to mozilla-iam/pyoidc that referenced this pull request Jun 6, 2019
* Modified fetch_distributed_claims

* Use HTTP GET for all requests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants