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

RBAC with multiple roles and chains-friendly #66

Merged
merged 4 commits into from
Aug 17, 2020
Merged

RBAC with multiple roles and chains-friendly #66

merged 4 commits into from
Aug 17, 2020

Conversation

umputun
Copy link
Member

@umputun umputun commented Aug 17, 2020

Converted RBAC middleware to a more traditional signature and added support of matching against multiple roles.

The reason for this change - in any modern framework supporting middleware chains (i.e. route.With(middleware, middleware2, ....) the old signature expecting handler as a part of the call is not smth usual and not easy to use. In addition, in practical use cases, one route (or group of routes) often allowed for multiple roles.

Another thing included in this PR - old test with ClaimUpdater counted on token's refresh and didn't work in normal circumstances. I'm not really sure how it even passed Actions CI, probably due to incorrect (different) clock on action workers. Replaced by pre-generated token and simplified test's code.

@kleash pls take a look. This change won't be backward compatible but I think it will be the right thing to do.

@umputun umputun changed the title Rbac with multiple roles and chains-friendly RBAC with multiple roles and chains-friendly Aug 17, 2020
@github-actions
Copy link

Pull Request Test Coverage Report for Build 211706299

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 94.5%

Totals Coverage Status
Change from base Build 210642862: 0.0%
Covered Lines: 189
Relevant Lines: 200

💛 - Coveralls

@kleash
Copy link
Contributor

kleash commented Aug 17, 2020

Looks good, I was going to open PR for multiple roles, but this covers everything well.

@umputun umputun merged commit 9a46108 into master Aug 17, 2020
@umputun umputun deleted the rbac branch August 17, 2020 08:25
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