与使用AllowAnonymous Azure的API应用程序 [英] Azure API Apps with AllowAnonymous

查看:212
本文介绍了与使用AllowAnonymous Azure的API应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

随着Azure的应用程序的API,是有办法对不同的端点认证级别的基础Web API中混合?

With an Azure API App, is there a way to have a mix of authentication levels for different endpoints in the underlying Web API?

我要的API应用程序拥有的访问级别公共(认证),但其中一个端点必须以匿名用户访问。 previously我刚才应用的方法使用AllowAnonymous 属性,但仍网关截获并返回一个未经身份验证的响应。

I want the API App to have access level of 'Public (authenticated)' but one of the endpoints needs to be accessible as an anonymous user. Previously I would have just applied the AllowAnonymous attribute on the method, but the gateway still intercepts and returns an unauthenticated response.

我能想到的唯一的事情就是设置API应用程序为公共(匿名),然后使用上的Web API通常的授权属性,但不完全知道如何做到这一点发挥出与在Azure的应用服务模式的网关处理身份验证。

The only other thing I can think of is to set the API App to 'Public (anonymous)' and then use the usual Authorize attribute on the Web API, but not entirely sure how this would play out with the Gateway handling authentication in the Azure App Service model.

推荐答案

不幸的是,没有办法做到这一点的今天,除非你处理验证自己,就像你描述。

Unfortunately, there isn't a way to do this today, unless you handle the authentication yourself, just like you described.

您会仍然得到应用服务和扬鞭的所有优点,却唯独没有对网关的认证。

You'll still get all the benefits of App Service and Swagger but just not the Authentication on the Gateway.

这是一个很好的建议进行跟踪,请在我们UserVoice反馈论坛发布你的想法

This is a good suggestion to track, please post your ideas at our Uservoice feedback forum

这篇关于与使用AllowAnonymous Azure的API应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆