Securing an API
We can now secure every API project. However, there are different ways we can do this so that we can reduce the work we need to do. One option is to use Azure Container Apps to configure authentication. Instead of configuring this for every container app, let’s create a new project that will be secured and routed to multiple services. For this, we’ll use YARP.
Creating a new project with authentication
Create a new Web API project by using the .NET template with the -au
authentication option:
dotnet new webapi -minimal -au IndividualB2C -o Codebreaker.ApiGateway
Using the .NET CLI, you can also pass all the values needed to configure the B2C service, such as --domain
for the domain, --aad-b2c-instance
to pass the domain link for logging in, --client-id
for the application ID, --susi-policy-id
for the signup user flow (before it was called user flow, it was called policy), and --default-scope
to configure a scope. If you don’t assign...