How ozgurkarahan/backend works
Main Components
• API Backend – Represent the .NET Core web API (located in the src/Api.Poc.OAuth folder). Illustrate its internal structure by including:
– Controllers (e.g., TodoListController and ValuesController)
– Extensions (for configuring and handling Azure AD authentication)
– Models (such as the TodoItem class)
– Configuration files (appsettings.json / appsettings.Development.json) that determine environment settings.
• ARM Templates – Show this as an infrastructure/deployment component:
– The “webapptemplate.json” and its parameters to deploy the API as an Azure App.
– The “importapi.json” ARM template that imports the API (using the swagger definition) into an Azure API Management instance and adds the jwt validation policy.
• Swagger Documentation – Indicate that the swagger.json file in the src/swagger folder provides the API’s documentation, which is used during the API import process.
• Azure Active Directory (Azure AD) – Represent the third-party identity provider that issues tokens and handles the OAuth 2.0 authentication needed for JWT validation.
Relationships and Data Flow
• Client/Application Requests – Start with external clients that send requests to your API.
• API Gateway – Illustrate that these client requests first go to the Azure API Management gateway, which then forwards valid calls to the deployed web API.
• API Backend – The web API (hosted as an Azure App, deployed with the webapptemplate ARM template) receives those requests, and uses its integrated JWT validation logic (using extensions and Azure AD configurations) to authorize them.
• Swagger – Also, show that your swagger.json file plays a role in defining the API’s interface, which is used by the ARM template for API import into API Management.
Architectural Patterns and Design Principles
• Separation of Concerns – The web API is clearly separated into controllers, configuration, and utility/extensions handling authentication.
• Infrastructure as Code – The use of ARM templates demonstrates that the deployment and integration with Azure API Management are automated, emphasizing repeatable, consistent infrastructure deployment.
• Secure Gateway Pattern – The API Management instance acts as a secure API gateway: applying policies (such as JWT validation) and routing requests to the back-end service only after proper authorization.
– Client → Azure API Management → Azure App (API Backend)
– Azure API Management ← uses swagger to import API and applies JWT policies.
– API Backend ↔ Azure AD (for token validation)
– Use a different style for deployment/infrastructure elements (ARM Templates).