Replies: 2 comments 5 replies
-
@HomerBart public async Task<IActionResult> Action()
{
HttpContext.VerifyUserHasAnyAcceptedScope(scopeRequiredByAPI);
HttpContext.ValidateAppRole("acceptedRole1");
} Does it work for you? |
Beta Was this translation helpful? Give feedback.
4 replies
-
@HomerBart : are you using ASP.NET Core ? or .NET 5.0+ ? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am creating a new .NET 5.0 web API that will have actions that need to be called by both applications on behalf of users and by daemon applications. For a single action can Microsoft.Identity.Web be used to verify the scopes (if the action has been called on behalf of a user) or app roles (if the the action is called by a daemon application)? Also is there any documentation or sample code that demonstrates how to do this?
All the documentation I've read so far only seems to cover the scenarios where a single action is called either on behalf of a user or by a daemon application but not both.
I think this question is similar to the issue How to verify scope or app role in the same controller action, however that issue has been closed and doesn't really answer the question.
Thank you
Beta Was this translation helpful? Give feedback.
All reactions