简体   繁体   中英

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. This is usually achieved with decorating controllers or methods with [Authorize] and putting parts of pages inside 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] . How can I provide the desired functionality using AAD?

Thanks to Brendan Green to pointing me to the answer. The main change that is needed is changing the system.web to allow users.

<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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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