Every web application must consider security. With the aid of this blog, you may integrate the most recent authentication standard, OpenID Connect (OIDC), into a.NET core application.
Due to the intricate processes that must be performed precisely, implementing a protocol is a laborious task. A library called Duende Identity Server can be used with.NET applications to serve as an authentication provider for those applications. You will find more information about the Duende Identity Server here. This is a good library for small projects who don’t want to implement costly identity solutions for authentication.
I have created a sample Microservice project. You can find it on GitHub.
Github Repo: oidc-in-react-with-dotnet-core-microservices-ocelot-gateway
- Management.API (https://localhost:6001/)– Microservice which contains APIs to be accessed by different Web Apps
- IdentityServerAspNetIdentity (https://localhost:5001) – Identity Microservice, this will work as your Security Token Server
- Management.Client.ReactTS (https://localhost:5002/) – Client Web App in React Typescript
- Management.Ocelot.APIGateway – Currently, this is working as APIGateway for a single microservice i.e. Management.API. You can have more microservices. I am currently showing only one microservice for this example.
The folder structure looks like below,
GitHub repo: oidc-in-razor-with-dotnet-core-microservices-ocelot-gateway
- Management.API (https://localhost:6001/)– Microservice which contains APIs to be accessed by different Web Apps
- IdentityServerAspNetIdentity (https://localhost:5001) – Identity Microservice, this will work as your Security Token Server
- Management.Razor (https://localhost:5002/) – Client Web App
- Management.Ocelot.APIGateway – Currently, this is working as APIGateway for a single microservice i.e. Management.API. You can have more microservices. I am currently showing only one microservice for this example.
The folder structure looks like below,