-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Support JWT scopes to allow or reject requests in OAuth2 plugin #1272
Comments
can you provide an example? |
The following is the scenario I have in mind. The getProducts endpoint should be accessible via a token which has the read scope. curl http://127.0.0.1:9080/apisix/admin/routes/5 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/getProducts",
"plugins": {
"proxy-rewrite": {
"scheme": "https"
},
"openid-connect": {
"client_id": "api_six_client_id",
"client_secret": "client_secret_code",
"discovery": "full_URL_of_the_discovery_endpoint",
"required_scope": "read_scope",
}
}
}' And the deleteProducts endpoint should be accessible via the token with a deletescope. curl http://127.0.0.1:9080/apisix/admin/routes/5 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/deleteProducts",
"plugins": {
"proxy-rewrite": {
"scheme": "https"
},
"openid-connect": {
"client_id": "api_six_client_id",
"client_secret": "client_secret_code",
"discovery": "full_URL_of_the_discovery_endpoint",
"required_scope": "delete_scope",
}
}
}' This is how the core OpenID Library is suggesting to handle this scenario.
|
@moonming you can take a look |
@moonming any thoughts on this enhancement? |
|
Is it still in need? |
@spacewander, I believe there's still a need for this ticket. The openid-connect plugin introduced a scope property for a different purpose. The scope property described in the ticket would allow us to accept/reject the request. |
I second that. I believe that this is indeed a very useful addition, and should definitely be reconsidered. |
I believe that this need is partially or completely fulfilled by this fix: #10493 |
|
considered resolved |
Issue description
The JWT contains the scopes available for a user via the scope attribute. Scope represents the capabilities the token has such as
read
ordelete
. It would be good if we can define a required set of scopes and allow or reject the request based on the required scope.The text was updated successfully, but these errors were encountered: