简体   繁体   English

通过 Azure 门户中的“身份验证”刀片与 Startup.cs 中的手动保护 Function 应用程序

[英]Securing Function App via 'Authentication' blade in Azure Portal vs. manually in Startup.cs

I secured my ASP.NET Core Azure Function App by modifying the configuration in Startup.cs and calling the Microsoft.Identity.Web's AddAuthentiction and AddMicrosoftIdentityWebApi extension methods on the services collection object (similar to the approach used in the AzureFunctions example in the Tests directory of the GitHub repo of Microsoft.Identity.Web). I secured my ASP.NET Core Azure Function App by modifying the configuration in Startup.cs and calling the Microsoft.Identity.Web's AddAuthentiction and AddMicrosoftIdentityWebApi extension methods on the services collection object (similar to the approach used in the AzureFunctions example in the Tests directory of the Microsoft.Identity.Web 的 GitHub 存储库)。 This allows me to securely call the Azure Function API from my Blazor Server app using Microsoft Identity Platform.这允许我使用 Microsoft 身份平台从我的 Z98AD8B3C99B3CA16F1F7FA84EE6 服务器安全地调用 Azure Function API。 The Azure Functions API does not call any downstream api. Azure 函数 API 不调用任何下游 api。

This approach works perfectly fine without the need to enable the Authentication option under Function App - Setting in Azure Portal and specifying an identity provider there and linking it to an Azure AD app registration.这种方法工作得很好,无需启用 Function 应用程序下的身份验证选项- 在 Azure 门户中设置并在那里指定身份提供者并将其链接到 Z3A580F142203677F1F0BC30898F63F 应用程序注册。

Does somebody know what does enabling authentication and adding an identity provider under settings of the Function App in the Azure Portal do compared to the manual configuration in Startup.cs?与 Startup.cs 中的手动配置相比,有人知道在 Azure 门户中的 Function 应用程序的设置下启用身份验证和添加身份提供者有何作用? If I understand correctly, it does the same thing but implicitly instead of explicitly in the Startup.cs.如果我理解正确,它会做同样的事情,但在 Startup.cs 中是隐式而不是显式的。

That option, sometimes referred as "Easy Auth" enables an additional container (or program) that will validate the token, so you don't have to.该选项(有时称为“Easy Auth”)启用了一个额外的容器(或程序)来验证令牌,因此您不必这样做。 Request will first go to that middleware application and then, if validation passes, will go to your app.请求将首先 go 到该中间件应用程序,然后,如果验证通过,将 go 到您的应用程序。

For details see the docs page: https://docs.microsoft.com/en-us/azure/app-service/overview-authentication-authorization有关详细信息,请参阅文档页面: https://docs.microsoft.com/en-us/azure/app-service/overview-authentication-authorization

That option is common to the webapps and function apps.该选项对 webapps 和 function 应用程序很常见。 The code runs separately, so it's not part of your application middleware chain.代码单独运行,因此它不是应用程序中间件链的一部分。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 how to read azure app config values in C# startup.cs class in azure function - how to read azure app config values in C# startup.cs class in azure function 在 Azure Function 中引用类库 .dll 文件,是否需要在 Startup.cs 中设置服务? - Referencing class library .dll file in Azure Function, do I need to setup the services in Startup.cs? 连接到 .NET 3.1 中的 Entity Framework Core - Connect to Entity Framework Core in .NET 3.1 Azure Function Project Startup.cs .net 5 登录到 azure 应用程序服务协议 stream 在 startup.cs 之外不起作用 - .net 5 logging to azure app service protocol stream not working outside startup.cs 为什么启动我的Azure Function时没有使用startup.cs文件? - Why is the startup.cs file not being used when I start my Azure Function? 是否可以访问 Startup.cs 中的任何 Azure Function 触发器详细信息/上下文? - Is it possible to access any Azure Function trigger details/context in Startup.cs? 为什么我的 Azure Function 无法在 startup.cs 中正确加载我的环境变量? - Why would my Azure Function not load my environment variables correctly in startup.cs? 在 Startup.cs 之外更新 asp.net 核心身份验证 - Update asp.net core Authentication outside of Startup.cs 在 MVC5 项目中添加 Startup.cs 文件,无需身份验证 - Add a Startup.cs file in MVC5 project without authentication 在startup.cs上的IIS 8.5配置(Azure webrole) - IIS 8.5 configuration on startup.cs (Azure webrole)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM