From the course: Microservices: Security

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Work with OAuth 2.0 endpoints

Work with OAuth 2.0 endpoints

From the course: Microservices: Security

Work with OAuth 2.0 endpoints

- [Instructor] To get a better sense of how an OAuth flow works, we're going to secure and access a small .NET microservice. For our example, I built a small web API that returns a user's chat messages, which are stored in a SQL server database. So, this is the microservice that we registered in Microsoft Entra, and now we will implement token-based authorization for it. .NET Has great integration with Microsoft Entra that makes it really simple to achieve that for a microservice. If you've worked with any web framework before, you're probably familiar with the concept of a controller, or something similar that processes a web request. Here, in this controller, you'll notice we defined these two annotations, authorize and required scope. These allow our microservice to authorize incoming requests using an access token. The authorized attribute will cause .NET to validate the token it receives from the client, and then, the required scope attribute points to a scope's property that's…

Contents