-
Notifications
You must be signed in to change notification settings - Fork 272
generic api
Jean-Marc Prieur edited this page May 3, 2023
·
6 revisions
- You have a web API written in any language
- Your web API receives a token and wants to validate it, and call downstream web APIs
- Instead of doing it yourself, your web API will call a service (another web API) that will handle all this for you web API.
This article explains how you can implement such a service, using Microsoft.Identity.Web 2.x
The appsettings.json has several sections.
- The "AzureAd" section is usual. It contains the ClientId of your web API, and the client credentials for your wwb API.
- The next section, "DownstreamApis", describes the downstream APIs that you want to call:
- the name of the service
- and the parameters describing this service to call. The parameters are of type: DownstreamApiOptions. Among the parameters you'll provide, you'll have the URI of the API to call, the scopes, and all the parameters that are needed for the service to authenticate
{
"AzureAd": {
"Instance": "https://login.microsoftonline.com/",
"TenantId": "22222222-2222-2222-2222-222222222222",
"ClientId": "11111111-1111-1111-11111111111111111",
"ClientCredentials": [
{
}
],
"Scopes": "access_as_user",
},
"DownstreamApis": {
"Api1": {
"BaseUrl": "URL",
"Scopes": "SCOPES"
},
"Api2": {
"BaseUrl": "https://graph.microsoft.com/v1.0",
"Scopes": "user.read"
}
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}- Home
- Why use Microsoft Identity Web?
- Web apps
- Web APIs
- Minimal support for .NET FW Classic
- Logging
- Azure AD B2C limitations
- Samples
- Certificates
- Managed Identity as Federated Credential
- Federated Credentials from other Identity Provider
- Extensibility: Bring your own credential
- Get client secrets from KeyVault
- Web apps
- Web app samples
- Web app template
- Call an API from a web app
- Managing incremental consent and conditional access
- Web app troubleshooting
- Deploy to App Services Linux containers or with proxies
- SameSite cookies
- Hybrid SPA
- Web APIs
- Web API samples
- Web API template
- Call an API from a web API
- Token Decryption
- Web API troubleshooting
- web API protected by ACLs instead of app roles
- gRPC apps
- Azure Functions
- Long running processes in web APIs
- Authorization policies
- Generic API
- Customization
- Logging
- Calling graph with specific scopes/tenant
- Multiple Authentication Schemes
- Utility classes
- Setting FIC+MSI
- Mixing web app and web API
- Deploying to Azure App Services
- Azure AD B2C issuer claim support
- Performance
- specify Microsoft Graph scopes and app-permissions
- Integrate with Azure App Services authentication
- Ajax calls and incremental consent and conditional access
- Back channel proxys
- Client capabilities