0
votes

Trying to fetch user identity post azure active directory authentication inside controller.After registering the application with redirect URI "https://localhost:portnumber/sign-oidc" mentioned clientid, tenantid,domain and callback("/sign-oidc") inside appsettings.json.Next inside configure service of startup class added azureAD scheme to read details from json file and added authorize attribute inside controller.After calling one action inside controller getting user identity perfectly but when the application published in azure appservice plan and mentioned RedirectURI inside Azure AD registration's authentication part as the appserviceUrl like "https://appserviceURL/sign-oidc" it is not fetching User identity even application is not running.Any solution will be helpful.

1

1 Answers

0
votes

Hope you are using Authentication and authorization in Azure App Service

App Service passes user claims to your application by using special headers. External requests aren't allowed to set these headers, so they are present only if set by App Service. Some example headers include:

  • X-MS-CLIENT-PRINCIPAL-NAME
  • X-MS-CLIENT-PRINCIPAL-ID
  • X-MS-TOKEN-AAD-ID-TOKEN
  • X-MS-TOKEN-AAD-ACCESS-TOKEN

Reference :- https://docs.microsoft.com/en-us/azure/app-service/app-service-authentication-how-to#access-user-claims

Code that is written in any language or framework can get the information that it needs from these headers.