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 an example to illustrate the use of authz package #5900

Closed
easwars opened this issue Dec 28, 2022 · 11 comments · Fixed by #7226
Closed

Add an example to illustrate the use of authz package #5900

easwars opened this issue Dec 28, 2022 · 11 comments · Fixed by #7226
Assignees
Labels

Comments

@easwars
Copy link
Contributor

easwars commented Dec 28, 2022

We have an authz implementation which is split up as the API and the engine.

The API supports two ways of specifying the authorization policy: as a static string, or as a file to watch. The second method supports online updates to the policy.

We should have examples which illustrates the use of both.

Existing tests can serve as good starting point to understand the usage of the API.

@zasweq
Copy link
Contributor

zasweq commented Sep 19, 2023

This issue was partially fixed by #5920, as this PR demonstrated an example through a hardcoded string. The file to watch section still needs to be addressed, as that opens up a different way of technically updating the policy in that case.

@shashank-priyadarshi
Copy link

Hi @ginayeh , I can work on this!

@arvindbr8
Copy link
Member

@shashank-priyadarshi -- thanks! Assigning this to you.

PS: please make sure that the issue is assigned to you while you are actively working on it. This would make sure we dont have multiple contributors working on the same issue

@arvindbr8 arvindbr8 removed the Type: Feature New features or improvements in behavior label Oct 17, 2023
@v-sreejith
Copy link

Hi @arvindbr8, I would like to contribute.

@arvindbr8
Copy link
Member

@v-sreejith -- Seems like this one is already assigned! Thanks for your interest.

@arvindbr8
Copy link
Member

@v-sreejith -- ping

@Kailun2047
Copy link
Contributor

@arvindbr8 Hi, can I work on this one if a file watcher example is still needed? I've gone through the existing tests referenced in the issue description and have got a grasp on what this one is about :)

@easwars
Copy link
Contributor Author

easwars commented May 2, 2024

@Kailun2047 Let us know what you have in mind for the example. Let's have a discussion before you get too deep into actual implementation. Thanks.

@Kailun2047
Copy link
Contributor

@easwars Sure. I'm thinking about extending the current example a bit. Concretely:

  • add an example JSON policy file to hold policy content that's meant to be identical to the hardcoded one but with intentional typos in both header keys
  • for server, modify server/main.go to accept an optional flag that starts the server using file watcher authz interceptors (unary & streaming) that watches the file mentioned above
  • for client, keep it as is

When the example is run, the client will first end up with unexpected PermissionDenied error when requesting with authorized role. Instruct our users to then manually fix the JSON policy file while keep the server running, and start the client again to get the expected responses. Maybe we can also have GRPC_GO_LOG_SEVERITY_LEVEL set when running the example server, so that the reload status of the policy can be spotted.

@easwars easwars assigned easwars and unassigned Kailun2047 May 6, 2024
@easwars
Copy link
Contributor Author

easwars commented May 6, 2024

@Kailun2047 : Sounds like a good plan. Looking forward to reviewing your PR.

@Kailun2047
Copy link
Contributor

@easwars Just put up #7226 for this. Please take a look when you get time. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants