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

refactor(cmd-api-server): pull OAuth2 endpoint scopes from openapi.json #3463

Merged

Conversation

aldousalvarez
Copy link
Contributor

@aldousalvarez aldousalvarez commented Aug 7, 2024

Commit to be reviewed


refactor(cmd-api-server): pull OAuth2 endpoint scopes from openapi.json

Primary Changes
----------------
1. added OAuth2 security endpoints scopes to openapi.json
2. added a test to make sure if the scopes are indeed getting 
   pulled from the spec file

Fixes #2693

Pull Request Requirements

  • Rebased onto upstream/main branch and squashed into single commit to help maintainers review it more efficient and to avoid spaghetti git commit graphs that obfuscate which commit did exactly what change, when and, why.
  • Have git sign off at the end of commit message to avoid being marked red. You can add -s flag when using git commit command. You may refer to this link for more information.
  • Follow the Commit Linting specification. You may refer to this link for more information.

Character Limit

  • Pull Request Title and Commit Subject must not exceed 72 characters (including spaces and special characters).
  • Commit Message per line must not exceed 80 characters (including spaces and special characters).

A Must Read for Beginners
For rebasing and squashing, here's a must read guide for beginners.

@aldousalvarez aldousalvarez force-pushed the aldousalvarez/issue2693 branch from 3321ed3 to f44cf0c Compare August 7, 2024 11:51
@aldousalvarez aldousalvarez requested a review from outSH August 7, 2024 11:52
Copy link
Contributor

@outSH outSH left a comment

Choose a reason for hiding this comment

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

LGTM, Thank you!

@aldousalvarez aldousalvarez force-pushed the aldousalvarez/issue2693 branch from f44cf0c to 25c1eba Compare August 21, 2024 14:40
@aldousalvarez
Copy link
Contributor Author

aldousalvarez commented Aug 21, 2024

Hello @petermetz, Already done the requested changes, re-requested for your review. Thank you

Copy link
Contributor

@petermetz petermetz left a comment

Choose a reason for hiding this comment

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

@aldousalvarez Looking much better now but it's still missing the crucial negative test case for missing or incorrect scopes, please see my comment above.

@aldousalvarez aldousalvarez force-pushed the aldousalvarez/issue2693 branch 3 times, most recently from dade3eb to 4c58d17 Compare September 6, 2024 03:40
@petermetz petermetz force-pushed the aldousalvarez/issue2693 branch from 4c58d17 to 20d64d4 Compare October 4, 2024 02:39
@aldousalvarez aldousalvarez force-pushed the aldousalvarez/issue2693 branch 2 times, most recently from af634c3 to 21fdde9 Compare October 9, 2024 12:48
@aldousalvarez aldousalvarez force-pushed the aldousalvarez/issue2693 branch from 21fdde9 to a637f50 Compare October 10, 2024 07:54
Copy link
Contributor

@petermetz petermetz left a comment

Choose a reason for hiding this comment

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

@aldousalvarez Please fix the rest of the failing tests of the cmd-api-server package and also the custom-checks check which also is failing.

@aldousalvarez aldousalvarez force-pushed the aldousalvarez/issue2693 branch from a637f50 to 916d802 Compare October 21, 2024 11:31
@aldousalvarez
Copy link
Contributor Author

Hello @petermetz I added another test case where it would be 403, and then I also added that it logs which status code it gets,. Should I also add 403 in the responses on the openapi.json as well? Thanks

@petermetz
Copy link
Contributor

Hello @petermetz I added another test case where it would be 403, and then I also added that it logs which status code it gets,. Should I also add 403 in the responses on the openapi.json as well? Thanks

@aldousalvarez Sorry for the slow response! Thank you for the changes and to your question: Yes, please declare the 403 in the openapi.tpl.json spec as well (and make sure to run codegen so that it updates openapi.json also)

@aldousalvarez aldousalvarez force-pushed the aldousalvarez/issue2693 branch 25 times, most recently from 125ab22 to c6b26c7 Compare November 28, 2024 19:02
Copy link
Contributor

@petermetz petermetz left a comment

Choose a reason for hiding this comment

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

LGTM

Primary Changes
----------------
1. added OAuth2 security endpoints scopes to openapi.json
2. added a test to make sure if the scopes are indeed getting
   pulled from the spec file

Fixes hyperledger-cacti#2693

Signed-off-by: aldousalvarez <aldousss.alvarez@gmail.com>

1. Please also refactor the third endpoint (prometheus metrics) accordingly
2. Also please extend the test case with each tokens having specific scopes
and then assert that the tokesn with the correct scopes work and the ones
that don't have the correct scopes do not even when they are otherwise
valid tokens.

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
@petermetz petermetz force-pushed the aldousalvarez/issue2693 branch from c6b26c7 to 825a7bd Compare December 1, 2024 16:30
@petermetz petermetz merged commit 467a1c0 into hyperledger-cacti:main Dec 1, 2024
131 of 137 checks passed
@petermetz petermetz deleted the aldousalvarez/issue2693 branch December 1, 2024 16:42
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.

refactor(cmd-api-server): pull OAuth2 endpoint scopes from openapi.json
3 participants