Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Authorization Grants using JWT #546

Closed
wants to merge 26 commits into from

Conversation

Xopek
Copy link
Contributor

@Xopek Xopek commented Dec 14, 2020

Related issue

#305

Proposed changes

Support for JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants (RFC7523)

Checklist

  • I have read the contributing guidelines
    and signed the CLA.
  • I have read the security policy.
  • I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security vulnerability, I
    confirm that I got green light (please contact
    security@ory.sh) from the maintainers to push
    the changes.
  • I have added tests that prove my fix is effective or that my feature
    works.
  • I have added necessary documentation within the code base (if
    appropriate).

Further comments

Implementation details were discussed with @aeneasr beforehand

Vladimir Kalugin and others added 23 commits December 14, 2020 13:34
@CLAassistant
Copy link

CLAassistant commented Dec 14, 2020

CLA assistant check
All committers have signed the CLA.

@Xopek Xopek changed the title Auth grant type jwt bearer feat: Authorization Grants using JWT Dec 14, 2020
Copy link
Member

@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

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

I hope your are not initimidated by the flood of comments. In general this looks very solid already, but I think we can improve it a bit in terms of readability and I also left some security-related ideas :)

Once the next pass is done, I will have another look at the tests, and if nothing serious comes up I think this is pretty much good to go!

expect: &AccessRequest{
GrantTypes: Arguments{"foo"},
Request: Request{
Client: client,
Copy link
Member

Choose a reason for hiding this comment

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

Where does this client come from? Shouldn't the client be nil? What I also don't fully understand is - store := internal.NewMockStorage(ctrl) does not seem to have any EXPECT calls?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is default empty client struct. When Request is created default value is used for client, so it is just an empty struct. So we are checking, that even without client auth (and hence storage wont be called, and client struct will stay empty) everything is working.

Considering storage - it is not expected to be called, because we are not passing any client credentials. However i agree that it is not very clear why is that. That's why i will add case, where we WILL pass client credentials and in other cases will add explicit instruction, that we are not expecting storage to be called.

Copy link
Contributor Author

@Xopek Xopek Jan 18, 2021

Choose a reason for hiding this comment

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

Also i am suggesting to rewrite the whole tests in this file completely, because each test affects other test, because they share mocks and other vars which results in that test cases are not isolated from each other. That's why new tests that were added in this PR were made using suite package of testify. Only in this file i write new test cases in the same style as old ones.

If you are not against this idea maybe i can rewrite them using suite, but i will made it in separate PR.

@Xopek
Copy link
Contributor Author

Xopek commented Dec 17, 2020

I hope your are not initimidated by the flood of comments. In general this looks very solid already, but I think we can improve it a bit in terms of readability and I also left some security-related ideas :)

Once the next pass is done, I will have another look at the tests, and if nothing serious comes up I think this is pretty much good to go!

No problem at all!)

@aeneasr
Copy link
Member

aeneasr commented Jan 11, 2021

Are you still up for the changes? :) If you need any help, let us know!

@Xopek
Copy link
Contributor Author

Xopek commented Jan 11, 2021

Are you still up for the changes? :) If you need any help, let us know!

Yes! Just need to do some work and then i will return to this PR =)

@Xopek
Copy link
Contributor Author

Xopek commented Jan 19, 2021

Ok, i addressed all comments and made necessary changes, have a look)

@aeneasr
Copy link
Member

aeneasr commented Jan 22, 2021

Hello, I wanted to review this today but am too tired to give it the attention it needs. I will try again on Monday :)

@aeneasr aeneasr closed this in 9720241 Feb 5, 2021
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.

5 participants