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(auth): handle grant choice params correctly #671

Merged
merged 7 commits into from
Oct 26, 2022
Merged

Conversation

njlie
Copy link
Contributor

@njlie njlie commented Oct 13, 2022

Changes proposed in this pull request

  • Current openAPI spec treats the "accept/reject" in the /accept or /reject grant endpoints as a query param, so the handler has been modified to reflect that.

Context

Checklist

  • Related issues linked using fixes #number
  • Tests added/updated
  • Documentation added
  • Make sure that all checks pass

@github-actions github-actions bot added pkg: auth Changes in the GNAP auth package. type: source Changes business logic type: tests Testing related labels Oct 13, 2022
@@ -445,7 +445,7 @@ describe('Grant Routes', (): void => {
)

const redirectUrl = new URL(config.identityServerDomain)
redirectUrl.searchParams.set('interactRef', grant.interactRef)
redirectUrl.searchParams.set('interactId', grant.interactId)
Copy link
Contributor

Choose a reason for hiding this comment

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

{
id: grant.interactId,
nonce: grant.interactNonce,
choice: GrantChoices.Accept
Copy link
Contributor

Choose a reason for hiding this comment

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

Add test for non-GrantChoices choice

@njlie njlie force-pushed the nl-handle-grant-choices branch from a8a6dc5 to ff2502f Compare October 17, 2022 19:38
@njlie njlie marked this pull request as ready for review October 17, 2022 20:16
@njlie njlie requested a review from wilsonianb October 17, 2022 20:16
@@ -265,15 +269,19 @@ async function acceptGrant(
ctx.body = {
error: 'request_denied'
}
return
Copy link
Contributor

Choose a reason for hiding this comment

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

Not related to the changes, but is it ok to use status = 400 above on L268 even though it's not listed as a possible returned status code in the Open API spec?

https://github.com/interledger/open-payments/blob/f365dbec4b9dec98b9f622bc49a92aea9ee01568/openapi/AS/IdP/openapi.yaml#L122-L128

Copy link
Contributor Author

@njlie njlie Oct 24, 2022

Choose a reason for hiding this comment

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

Some of this stuff (to my recollection) was written before the OpenAPI spec was brought in, so it's more like an initial stab. There could be something to adding a response to the spec for unexpected stuff, but later I will go over all these responses and decide if they should conform to an existing response or a new one should be added to the spec.

@njlie njlie merged commit d835284 into main Oct 26, 2022
@njlie njlie deleted the nl-handle-grant-choices branch October 26, 2022 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: auth Changes in the GNAP auth package. type: source Changes business logic type: tests Testing related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants