fix: ignore non-existent resource scopes during refresh #1222
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
We have implemented the RBAC feature in our system based on the oidc-provider. Leveraging
resourceIndicators.getResourceServerInfo
method to guard and filter the resource scopes being issued.What problem I have met
After a user is initially sign-in and authenticated, we manually revoke a role(resource scopes) from that user. Or delete the scopes directly from that resource indicator.
Expected behavior
The revoked resource scopes should be filtered from the newly exchanged access tokens.
As mentioned in the doc:
Actually behavior
Instead of reading the latest scopes returned from the resource server, the Provider uses the initially granted resource scopes pool to issue new access tokens. The scope can only be revoked till the user re-authenticates.
Summary
Any 'down-scope' action should take effect immediately to the end user. Attempt to filter out revoked or invalid resource scopes using the latest resource server info data in the refresh_token grant action.
Please let me know if there are any other recommended approaches. Thx.