简体   繁体   English

使用Azure Active Directory进行部分身份验证

[英]Partial Authentication with Azure Active Directory

My goal is to put certain pages in my MVC application behind authentication, and certain features behind authorized roles. 我的目标是将MVC应用程序中的某些页面置于身份验证之后,并将某些功能置于授权角色之后。 This is usually achieved with decorating controllers or methods with [Authorize] and putting parts of pages inside if(User.InRoles(...)){ ... } . 通常可以通过使用[Authorize]装饰控制器或方法并将部分页面放入if(User.InRoles(...)){ ... }

However the moment I add Azure Active Directory authentication to my project every URL on my site redirects to the login page, regardless of whether or not the controller is behind [Authorize] . 但是,当我将Azure Active Directory身份验证添加到项目时,站点上的每个URL都会重定向到登录页面,而不管控制器是否位于[Authorize] How can I provide the desired functionality using AAD? 如何使用AAD提供所需的功能?

Thanks to Brendan Green to pointing me to the answer. 感谢Brendan Green向我指出了答案。 The main change that is needed is changing the system.web to allow users. 需要进行的主要更改是更改system.web以允许用户使用。

<system.web>
    <authorization>
      <allow users="*" />
    </authorization>
    ...
</system.web>

Please view my blog post for the full description of code changes. 请查看我的博客文章以获取代码更改的完整说明。

Partial Authentication in AAD using WS Federation 使用WS Federation的AAD中的部分身份验证

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

相关问题 Azure Active Directory组织身份验证机制 - Azure Active Directory Organizational Authentication Mechasnim 使用Azure Active Directory进行身份验证的Web应用 - Web app using Azure active directory for Authentication 将参数传递给 Azure Active Directory 身份验证 - Passing parameters to Azure Active Directory authentication 在本地和Azure上使用Active Directory进行身份验证 - Using Active Directory for Authentication locally and on Azure Asp.net Identity使用密码和Azure Active Directory身份验证 - Asp.net Identity using password and Azure Active Directory authentication 开发环境的 Microsoft Azure Active Directory 身份验证登录 URL - Microsoft Azure Active Directory Authentication login URL for Dev environment Azure AD的Active Directory身份验证例外(AADSTS90027) - Active Directory Authentication Exception (AADSTS90027) with Azure AD Azure Active Directory -.Net Core 3 Web 应用程序 - 禁用 2 因素身份验证 - Azure Active Directory - .Net Core 3 Web Application - Disable 2 Factor Authentication 在测试环境中通过 Azure Active Directory 执行身份验证过程时出错 - Error when performing the authentication process by Azure Active Directory in test environment 如何将 Azure Active Directory 身份验证添加到 Razor Pages 应用程序? - How to add Azure Active Directory authentication to a Razor Pages app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM