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

Improve access rule middleware #485

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nox-4O4
Copy link

@nox-4O4 nox-4O4 commented Nov 21, 2022

This PR improves the access rule middleware:

  • bugfix: a non-matching deny rule wrongly blocks the request when evaluated a second time
  • bugfix: handler function gets executed multiple times when allow rules match
  • improvement: do not ignore multiple rules
  • housekeeping: simplify tests for access rule middleware

- bugfix: a non-matching deny rule wrongly blocks the request when evaluated a second time
- bugfix: handler function gets executed multiple times when allow rules match
- improvement: do not ignore multiple rules
- housekeeping: simplify tests for access rule middleware
func generateToken(alg, key string) (string, error) {
token := basejwt.NewWithClaims(basejwt.GetSigningMethod(alg), basejwt.MapClaims{
"country": "de",
"username": "test@hellofresh.com",

Choose a reason for hiding this comment

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

Mocked info?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, those are mocked / static claims for testing the access rules. (They were previously in between test cases, I moved them to the top.)

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.

None yet

2 participants