【问题标题】:Problem of fetching User Identity post Azure Azure Directory Authentication in a Published Webapp Inside Appservice plan在已发布的 Webapp Inside Appservice 计划中获取用户身份后 Azure Azure 目录身份验证的问题
【发布时间】:2020-11-29 04:41:26
【问题描述】:

尝试在控制器内获取用户身份后 azure Active Directory 身份验证。使用重定向 URI “https://localhost:portnumber/sign-oidc” 注册应用程序后,提到了客户端 ID、租户 ID、域和appsettings.json 中的回调(“/sign-oidc”)。在启动类的配置服务中添加了 azureAD 方案以从 json 文件中读取详细信息,并在控制器中添加了授权属性。在控制器中调用一个操作后完美地获取用户身份但是当在 azure appservice 计划中发布的应用程序并在 Azure AD 注册的身份验证部分中提到 RedirectURI 作为 appserviceUrl,例如 "https://appserviceURL/sign-oidc" 即使应用程序未运行,它也不会获取用户身份。任何解决方案会有所帮助。

【问题讨论】:

    标签: azure azure-active-directory azure-web-app-service


    【解决方案1】:

    希望你使用Authentication and authorization in Azure App Service

    应用服务使用特殊标头将用户声明传递给您的应用程序。不允许外部请求设置这些标头,因此它们仅在由应用服务设置时才存在。一些示例标题包括:

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

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

    以任何语言或框架编写的代码都可以从这些标头中获取所需的信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-02
      • 2012-06-06
      • 1970-01-01
      • 2017-10-30
      相关资源
      最近更新 更多