Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allow allow AD Group access

I have an ASP.NET website and I would like to only allow users in an AD group access to the site. I am using a web.config snippet as below, but this does not seem to work:

<authorization>
        <deny users="*" />
             <add accessType="Allow" roles="DOMAIN\GroupTest" />

        </authorization>

Any advice how to implement this is much appreciated!

like image 806
Blade1 Avatar asked Feb 08 '23 09:02

Blade1


1 Answers

You need to change your configuration as follows:

<configuration>
  <system.web>
    <!-- ... -->
    <authorization>
      <allow roles="DOMAIN\GroupTest" />
      <deny users="*" />
    </authorization>
    <!-- ... -->
  </system.web>
</configuration>

As described in this article, ASP.NET looks for a matching allow or deny rule when granting access. If a matching allow rule is encountered first, access is granted.

like image 65
Markus Avatar answered Feb 15 '23 22:02

Markus