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 JWT scopes validation #48

Merged
merged 1 commit into from
Jan 19, 2021
Merged

Add JWT scopes validation #48

merged 1 commit into from
Jan 19, 2021

Conversation

cdennig
Copy link
Contributor

@cdennig cdennig commented Nov 21, 2020

This PR adds the ability to validate scopes in a JWT token. The key for the scopes claim can be customized ("scopes_key" property) and the value can be read from a nested property in the token (same as for "role" validation). Additionally, the matching function can be customized: "any" returns "true" when at least one of the required scopes is available in the token, "all" means that all required scopes need to be included.

If the validation fails, a 403 will be returned.

Tests have been added.

@cdennig
Copy link
Contributor Author

cdennig commented Nov 21, 2020

PR for #47.

@cdennig cdennig changed the title Add JWT scopes validation Add JWT scopes validation / #47 Nov 21, 2020
@cdennig cdennig changed the title Add JWT scopes validation / #47 Add JWT scopes validation Nov 21, 2020
@cdennig
Copy link
Contributor Author

cdennig commented Nov 21, 2020

Unfortunately, this also adds now some redundancy - I am aware of that. Especially regarding the "roles" validation feature. But I did not want to change that on top without getting some feedback on that feature.

@saulo2
Copy link

saulo2 commented Jan 18, 2021

Please, accept this PR. It is an important feature. In fact, I am in need of it right now.

@kpacha kpacha merged commit ee6196d into krakend:master Jan 19, 2021
@kpacha
Copy link
Member

kpacha commented Jan 19, 2021

thanks for the contribution, @cdennig

let's update the CE and then we can revisit the implementation and look for redundant code

@cdennig
Copy link
Contributor Author

cdennig commented Jan 19, 2021

Sure...I can make a suggestion, but it'll take some time for me. I'm pretty busy atm.

@github-actions
Copy link

github-actions bot commented Apr 7, 2022

This pull request was marked as resolved a long time ago and now has been automatically locked as there has not been any recent activity after it. You can still open a new issue and reference this link.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants