My app consists of an Angular client and .NET Core Web API. I’m working on creating scopes, as explained in the docs (“Example: An API called by a first-party application”).
In my application, I have “widgets” that are owned and shared.
- all users can create widgets
- users can share widgets with other users
- users can update/view/delete their own widgets
- users can view widgets that are shared with them.
For the scopes, I’ve come up with:
create:widget
view-own:widget
view-shared:widget
delete-own:widget
update-own:widget
The applicable scopes will be sent to the API in a JWT.
The API will receive these scopes, and it’s the responsibility of the API to “convert” these scopes into actual permissions and actions. For example:
DeleteWidget(widget) {
if(scopes.contain("delete-own:widget") && widget.owner == user)
{
// delete the widget
}
}
Am I on the right track here regarding the scope definitions and responsibility of the API?
Thanks!