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

Add external policy mode #37

Merged
merged 4 commits into from
Oct 20, 2021
Merged

Conversation

jonnydgreen
Copy link
Collaborator

@jonnydgreen jonnydgreen commented Oct 15, 2021

Closes: #18

@jonnydgreen
Copy link
Collaborator Author

jonnydgreen commented Oct 15, 2021

Before I start the documentation and types etc I thought it would be good to get consensus on what I've done so far :) This PR implements as external policy mode as follows:

  • Define two new modes of operation:
    • directive (default) - unchanged
    • external-policy (default)
      • Define an auth policy:
        • On fields and types
        • Defined field policy is available as the first parameter of applyPolicy function
      • Works in both gateway and server mode
  • Existing functionality/options unaffected
  • Refactored the code so that the directive mode builds an external policy which is then registered as normal. As a result, these all share the same logic.

Are additional features/changes you'd like to look into for this? Let me know what you think :)

@jonnydgreen jonnydgreen changed the title Add external policy auth mode Add external policy mode Oct 15, 2021
Copy link
Contributor

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

looks good!!

@jonnydgreen
Copy link
Collaborator Author

Awesome! I'll sort out the final bits :)

@jonnydgreen jonnydgreen marked this pull request as ready for review October 16, 2021 11:56
README.md Show resolved Hide resolved
docs/api/options.md Outdated Show resolved Hide resolved
Copy link
Contributor

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@jonnydgreen jonnydgreen merged commit ba8e4f3 into main Oct 20, 2021
@jonnydgreen jonnydgreen deleted the feature/add-external-policy-support branch October 20, 2021 08:24
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.

How I can set custom directives to the current field?
2 participants