Azure 内置网站授权在返回我的网站后抛出权限错误

Azures inbuild Website Authorization throws permission error after returning to my site

通过 Azure 门户在我的网站上激活 "Authentication / Authorization" 时。

在我被重定向回我的网站后,我没有收到异常 "You do not have permission to view this directory or page."

它还会根据此 url 模式将我重定向回我的网站:https://{somewebsitename}.azurewebsites.net/{ActiveDirectoryApplicationGuid}/login

当我查看详细记录的错误时,我看到了这个错误:

<h3>HTTP Error 403.71 - Forbidden</h3> 
<h4>You do not have permission to view this directory or page.</h4> 
</div> 
<div class="content-container"> 
<fieldset><h4>Most likely causes:</h4> 
<ul>    <li>This is a generic 403 error and means the authenticated user is not authorized to view the page.</li> </ul> 
</fieldset> 
</div> 
<div class="content-container"> 
<fieldset><h4>Things you can try:</h4> 
<ul>    <li>Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click <a href="http://go.microsoft.com/fwlink/?LinkID=66439">here</a>. </li> </ul> 
</fieldset> 
</div> 
<div class="content-container"> 
<fieldset><h4>Detailed Error Information:</h4> 
<div id="details-left"> 
<table border="0" cellpadding="0" cellspacing="0"> 
<tr class="alt"><th>Module</th><td>&nbsp;&nbsp;&nbsp;EasyAuthModule_32bit</td></tr> 
<tr><th>Notification</th><td>&nbsp;&nbsp;&nbsp;AuthenticateRequest</td></tr> 
<tr class="alt"><th>Handler</th><td>&nbsp;&nbsp;&nbsp;ExtensionlessUrlHandler-Integrated-4.0</td></tr> 
<tr><th>Error Code</th><td>&nbsp;&nbsp;&nbsp;0x80004005</td></tr> 
</table> 
</div>

EasyAuthModule 不是我们代码或任何引用库的一部分。

我该如何解决这个问题? 这个确切的设置过去工作得很好,现在刚刚停止工作。这增加了混乱。

这是EasyAuthModule其实是微软的库。 Azure 支持人员通知我,他们刚刚迁移到本机库 EasyAuthModule

Glimpse 似乎存在兼容性问题。

从我的 web.config 中删除任何 Glimpse 参考后,它现在工作正常!

A​​zure 支持人员告诉我他们正在努力解决这个问题,因此我们可以再次使用 Glimpse。

Sam7 所述。 EasyAuthModule 是一个 HTTP 模块,作为身份验证/授权功能的一部分注入到网站进程中。最近对此模块进行了更改,这可能会导致与同一应用程序中的其他 HTTP 模块 运行 发生冲突。 Glimpse 就是这样一个 HTTP 模块,它的默认配置已知会导致与最新版本的 EasyAuthModule 发生冲突。

编辑:2015 年 9 月 30 日 最近对 EasyAuthModule 进行了更新,Glimpse 现在应该可以正常工作了。


警告,super-technical 详情如下


问题在于 Glimpse 模块等 HTTP 模块可能会在每个 HTTP 请求的开头读取 HTTP 请求实体 body。通常这很好,因为 ASP.NET 托管模块可以读取 ASP.NET 请求的内容而不会造成任何副作用。但是,这会阻止任何 non-ASP.NET 代码读取请求 body - 在这种情况下,Glimpse 会阻止新版本的 EasyAuthModule(它从 ASP.NET 托管模块转换为本机IIS 模块)读取用户登录时从 Azure AD 发送的登录令牌。结果是 HTTP 403.71 响应。

要解决此问题,您可以禁用正在读取 HTTP 请求内容的第 3 方模块(例如 Glimpse),或者将其配置为停止读取登录请求的请求内容(我相信 Glimpse,例如有一种方法可以排除某些 URL and/or 仅读取请求 headers - 我将遵从 documentation 的要求)。这将允许 EasyAuthModule 读取 Azure AD 登录令牌并成功验证 HTTP 请求。

从长远来看,EasyAuthModule 将被重构以确保它拦截 HTTP 请求之前第 3 方模块可以读取它们以避免此类兼容性问题.不幸的是,在做出永久修复之前,您现在需要修改您的配置以解决此问题。