You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This method must be called in the API methods you are implementing in web apis called by daemaons. In some situations this is a repeating activity with repeating code.
Describe the solution you'd like
Improve the situation by providing an IAuthorizationFilter decorator for API classes and methods like this:
[Authorize][RequiredAppRoles("admin","writer")
public classHomeController:Controller{/// ...publicasyncTask<IActionResult>Action(){}}
It should also be possible to provide the roles in the configuration
Additional context
Similar to #849, but for app roles (ClaimConstants.Roles et ClaimConstants.Role)
Todo
Understand if this is even necessary. Would the [Authorize(Roles="admin")] do the same? this is for roles of users, whereas here this is for daemon apps, but this might be the same underlying claims.
Depending on the outcome, if we want to do this:
Understand if we can share code with the scopes filter (maybe a based class with one virtual method which would provide th claims to validate and the error message to display?
Is your feature request related to a problem? Please describe.
The current version of microsoft-identity-web provides the RolesRequiredHttpContextExtensions.ValidateAppRole(HttpContext, String[]) Method to verify that the user authenticated in the web API has any of the accepted scopes.
This method must be called in the API methods you are implementing in web apis called by daemaons. In some situations this is a repeating activity with repeating code.
Describe the solution you'd like
Improve the situation by providing an IAuthorizationFilter decorator for API classes and methods like this:
It should also be possible to provide the roles in the configuration
then, you can reference it in the attribute:
Additional context
Similar to #849, but for app roles (ClaimConstants.Roles et ClaimConstants.Role)
Todo
[Authorize(Roles="admin")]
do the same? this is for roles of users, whereas here this is for daemon apps, but this might be the same underlying claims.Depending on the outcome, if we want to do this:
The text was updated successfully, but these errors were encountered: