简体   繁体   English

Azure 功能 身份验证 - 可能没有 AD?

[英]Azure functions Authentication - possible without AD?

I'm working on securing some Azure Functions endpoints.我正在努力保护一些 Azure Functions 端点。 I tried with Certificate, but I hit a few walls我尝试使用证书,但遇到了一些问题

  1. In the FunctionsStartup (from which derives my startup) I could not find a way to connect my AddAuth and Auth methods/classes.在 FunctionsStartup (从中派生出我的启动)中,我找不到连接我的 AddAuth 和 Auth 方法/类的方法。 (I tried to search, read more on this topic, but all the answers were either for web API other type of Authentications) (我尝试搜索,阅读有关此主题的更多信息,但所有答案都是针对 web API 其他类型的身份验证)
  2. I tried to check for the existence of a certificate at least, but that didn't worked either.我试图至少检查证书是否存在,但这也没有奏效。 I tried to get the certificate from request-context-connection-ClientCertificate or to read it from headers.我试图从 request-context-connection-ClientCertificate 获取证书或从标头中读取它。 Didn't worked locally or on deployed version.在本地或已部署的版本上不起作用。 The certificates are always null.证书始终为 null。

I saw that there are some options to secure it with AD(also with facebook, google and so on), but first I'm curious if someone successfully implemented another Auth method, more like in a classic web api approach (JWT tokens, certificate, other similar stuff)我看到有一些选项可以使用 AD 来保护它(也可以使用 facebook、google 等),但首先我很好奇是否有人成功实现了另一种 Auth 方法,更像是经典的 web Z8A5DA52ED126447D359E 方法(证书方法) ,其他类似的东西)

Access restrictions enable you to define a priority ordered allow/deny list that controls network access to your app. 访问限制使您能够定义优先排序的允许/拒绝列表,以控制对您的应用程序的网络访问。 The list can include IP addresses or Azure Virtual Network subnets .该列表可以包括IP addresses或 Azure Virtual Network subnets When there are one or more entries, there is then an implicit "deny all" that exists at the end of the list.当有一个或多个条目时,列表末尾会存在一个隐含的“全部拒绝”。

Also you can request a client certificate when the client request is over TLS/SSL and validate the certificate.您还可以在客户端请求通过 TLS/SSL 时请求客户端证书并验证证书。 This mechanism is called TLS mutual authentication or client certificate authentication.这种机制称为 TLS 相互认证或客户端证书认证。

First, your App Service plan must be in the Basic, Standard, Premium, or Isolated tier.首先,您的应用服务计划必须处于基本、标准、高级或隔离层。

Secondly, enable client certificates:其次,启用客户端证书:

az webapp update --set clientCertEnabled=true --name <app_name> --resource-group <group_name>

Finally, Access client certificate.最后,访问客户端证书。 App Service injects an X-ARR-ClientCert request header with the client certificate.应用服务使用客户端证书注入X-ARR-ClientCert请求 header。 Your app code is responsible for validating the client certificate.您的应用代码负责验证客户端证书。

For more details about how to configure TLS mutual authentication for Azure App Service, please refer to this article .有关如何为 Azure App Service 配置 TLS 相互认证的更多详细信息,请参阅本文

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM