0

I've inherited MVC4 application. It looks like Windows Authentication is used, but I also was told that "Active Directory Authentication" is used for some permissions. I do not see anything in web.config about Active Directory. In web.config:

<authentication mode="Windows" />
   <roleManager defaultProvider="DefaultRoleProvider">
      <providers>
         <add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=21bf1234ad634e53" connectionStringName="DefaultConnection" applicationName="/" />
       </providers>
   </roleManager>

In Controller:

[Authorize(Roles = @"ABCD\EFG"), HandleError(ExceptionType = typeof(UnauthorizedAccessException), View = "UnauthorizedUser", Order = 1)]
public class HomeController : Controller
{ .............

}

public ActionResult MyAction()
{

    if (!User.IsInRole(@"ABCD\EFG"))
    {
        // some code
    }

    //.............

}

Is "Active Directory Authentication" used in this application ?

Thank you

Karen Slon
  • 233
  • 1
  • 4
  • 16

1 Answers1

0

The windows authentication will indeed integrate with Active Directory as long as the application server is on the domain your users are registered in.

The below line in your config file enables such functionality.

<authentication mode="Windows" />

This post might help you get further: Configure ASP.NET MVC for authentication against AD

Community
  • 1
  • 1
StfBln
  • 1,137
  • 6
  • 11
  • Thank you StfBln, I saw post you've recommended, what confused me is that "Anonymous authentication" is enabled along with WA in my case, and no '..deny..' statements have been used. It seems using WA could be much simpler than in that post? – Karen Slon Mar 15 '17 at 18:29
  • I mean WA with AD – Karen Slon Mar 15 '17 at 18:29