Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure 使用应用程序服务的身份验证对功能应用程序进行授权_Azure_Azure Active Directory_Azure Web App Service_Azure Functions - Fatal编程技术网

Azure 使用应用程序服务的身份验证对功能应用程序进行授权

Azure 使用应用程序服务的身份验证对功能应用程序进行授权,azure,azure-active-directory,azure-web-app-service,azure-functions,Azure,Azure Active Directory,Azure Web App Service,Azure Functions,在Azure中,我有一个与功能应用程序通信的web应用程序服务。我在web应用程序上具有Azure AD身份验证。我想确保功能应用程序仅由经过身份验证的用户调用 作为一种选择,我在想是否可以将一些令牌或任何数据从web应用程序传递到函数应用程序,以验证用户 如果没有,请分享其他方法 注意:Web应用程序为Angular,函数应用程序为Java。如果Azure函数身份验证级别为匿名或还需要函数密钥,我们可以使用访问令牌直接访问Azure函数API。具体步骤如下 为Azure功能配置Azure广告。

在Azure中,我有一个与功能应用程序通信的web应用程序服务。我在web应用程序上具有Azure AD身份验证。我想确保功能应用程序仅由经过身份验证的用户调用

作为一种选择,我在想是否可以将一些令牌或任何数据从web应用程序传递到函数应用程序,以验证用户

如果没有,请分享其他方法


注意:Web应用程序为Angular,函数应用程序为Java。

如果Azure函数身份验证级别为匿名或还需要函数密钥,我们可以使用访问令牌直接访问Azure函数API。具体步骤如下

为Azure功能配置Azure广告。请参阅。 获取访问令牌 调用Azure函数
您需要测试Thread.CurrentPrincipal.Identity.IsAuthenticated属性,以确保调用函数应用程序的用户或应用程序已通过身份验证。函数应用程序采用java语言。我已在问题中更新了此信息。如果有人在前端进行了身份验证,然后我从前端调用函数app API,那么函数app如何知道有人是否进行了身份验证?要让函数应用程序知道这一点,需要做什么?还有另一个线程可以解决这个问题-
Method : POST
URL:  https://login.microsoftonline.com/your directory ID/oauth2/token 

Header:  
        Content-Type : application/x-www-form-urlencoded
Body
       "grant_type ": "client_credentials",
        "client_id": "the app id of the Azure AD application you project Azure function",
        "client_secret": ":the app secret of the Azure AD application you project Azure function",
        "resource": "the app id of the Azure AD application you project Azure function"