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

allow authentication webhook with POST (close #1138) #1147

Merged
merged 7 commits into from
Dec 3, 2018

Conversation

rakeshkky
Copy link
Member

@rakeshkky rakeshkky commented Nov 30, 2018

Description

What component does this PR affect?

  • Server
  • Console
  • CLI
  • Docs
  • Community Content
  • Build System

Requires changes from other components? If yes, please mark the components:

  • Server
  • Console
  • CLI
  • Docs
  • Community Content
  • Build System

Related Issue

close #1138

Solution and Design

Use --auth-hook-mode option or HASURA_GRAPHQL_AUTH_HOOK_MODE
env variable to set authentication webhook mode (POST or GET). Default is GET

Hasura's request to auth hook:-

POST https://my-authhook.com/post

   {
    "headers": {
      "header-key1": "header-value1",
      "header-key2": "header-value2"
      }
   }

Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Docs update
  • Community content

Checklist:

  • I have read the contributing guide and my code conforms to the guidelines.
  • This change requires a change in the documentation.
  • I have updated the documentation accordingly.
  • I have added required tests.

Resolve Conflicts:
	docs/graphql/manual/deployment/graphql-engine-flags/reference.rst
@rakeshkky rakeshkky added c/server Related to server c/build-system Related to the build-release system c/docs Related to docs labels Nov 30, 2018
@rakeshkky rakeshkky self-assigned this Nov 30, 2018
Copy link
Member

@shahidhk shahidhk left a comment

Choose a reason for hiding this comment

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

Can we change the flag/env var name to --auth-hook-mode=GET|POST with GET as default?

Env var will be HASURA_GRAPHQL_AUTH_HOOK_MODE=GET|POST

@hasura-bot
Copy link
Contributor

Review app for commit 0722d1c deployed to Heroku: https://hge-ci-pull-1147.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1147-0722d1c

@hasura-bot
Copy link
Contributor

Review app for commit cb07b83 deployed to Heroku: https://hge-ci-pull-1147.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1147-cb07b83

0x777
0x777 previously approved these changes Dec 3, 2018
@shahidhk
Copy link
Member

shahidhk commented Dec 3, 2018

@rikinsk Need your approval on docs.

@shahidhk shahidhk added the s/do-not-merge Do not merge this pull request to master label Dec 3, 2018
docs/graphql/manual/auth/webhook.rst Outdated Show resolved Hide resolved
docs/graphql/manual/auth/webhook.rst Show resolved Hide resolved
@shahidhk shahidhk removed the s/do-not-merge Do not merge this pull request to master label Dec 3, 2018
@hasura-bot
Copy link
Contributor

Review app for commit 1d8568b deployed to Heroku: https://hge-ci-pull-1147.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1147-1d8568b

@hasura-bot
Copy link
Contributor

Review app for commit a824638 deployed to Heroku: https://hge-ci-pull-1147.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1147-a824638

0x777
0x777 previously approved these changes Dec 3, 2018
shahidhk
shahidhk previously approved these changes Dec 3, 2018
@rikinsk-zz rikinsk-zz dismissed stale reviews from shahidhk and 0x777 via e12313a December 3, 2018 09:54
Copy link

@rikinsk-zz rikinsk-zz left a comment

Choose a reason for hiding this comment

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

Updated docs and approved

@hasura-bot
Copy link
Contributor

Review app for commit 553b855 deployed to Heroku: https://hge-ci-pull-1147.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1147-553b855

@shahidhk shahidhk merged commit 3ea20bc into hasura:master Dec 3, 2018
@hasura-bot
Copy link
Contributor

Review app https://hge-ci-pull-1147.herokuapp.com is deleted

hasura-bot pushed a commit that referenced this pull request Sep 24, 2024
<!-- The PR description should answer 2 important questions: -->

### What

This PR adds the `Spanned` type: an OpenDD wrapper that can be placed
inside the Metadata. It's basically a pair of the value and the path to
the value in the original metadata. This allows us to do things like
source maps.

<!-- What is this PR trying to accomplish (and why, if it's not
obvious)? -->

<!-- Consider: do we need to add a changelog entry? -->

<!-- Does this PR introduce new validation that might break old builds?
-->

<!-- Consider: do we need to put new checks behind a flag? -->

### How

It's almost exactly what @danieljharvey proposed originally.

<!-- How is it trying to accomplish it (what are the implementation
steps)? -->

---------

Co-authored-by: Daniel Harvey <[email protected]>
V3_GIT_ORIGIN_REV_ID: 4f037686b6981fffc4b0a8ac8f95c2f9c623af67
hasura-bot pushed a commit that referenced this pull request Sep 25, 2024
<!-- The PR description should answer 2 important questions: -->

### What

We would like to show error paths for `metadata-resolve` so that
debugging these errors is a little less painful, both for us and end
users. To this end, #1147 introduced a type wrapper that would be
deserialised to contain its own JSON path, so we could then pass this
path to errors. This PR does precisely this for the
`UnknownModelDataConnector` error.

I chose this error because... it was the first one on the list, not for
any reason beyond that. Right now, this is an extremely simple case
whereby only one path is required, however other errors may need two
("name at path X conflicts with name at path Y", for example). This PR
also changes the default engine error stdout to show the `Debug`
instance rather than the `Display` instance, as the error path is
discarded by the `Display` instance. Unfortunately, we use `Display` for
both stdout and user responses, which is maybe something we'd want to
change eventually, but for now this means we can't just add the error
path to the `Display` instance.

### How

I started by making `Model` a `Spanned` element within the metadata
structure. I then added the `path` key to the resolved `Model` type. I
then found the first error type that included a model name, and added
the `path` key to that error variant. Then, I just did the wiring.
You'll note that this error doesn't _alway_ return a path because it
isn't always raised by a model-first code path, but this is probably the
first PR of many.

### Next steps

* Next step is to make the output a little neater, probably by creating
an actual structured error type (most likely a lot like `Spanned`, with
a `path` and a `value`). Then, we can use a `Display` instance again to
print this nicely in the stdout, but ignore the path in the MBS API
response.

* After that, the plan is to stop ignoring it in the MBS API response,
with a new key to hold an error path.

* Step three is to allow for errors to produce multiple error paths in a
list, hopefully such that they tell a story ("I found this... but then I
found this... and those two things conflict")

* Step four will be a wave of PRs that look quite similar to this one,
wiring up paths to as many errors as possible.
<!-- How is it trying to accomplish it (what are the implementation
steps)? -->

V3_GIT_ORIGIN_REV_ID: 2d8dda018055f65711e66b08aa15188b516e2ddc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/build-system Related to the build-release system c/docs Related to docs c/server Related to server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support authorization webhooks with POST
6 participants