Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC3 authorization using AD

Is it possible to authorise/deny users of an MVC3 application using AD?

My app is secured using Windows authentication at the moment, but that means adding users to groups on the Win2007 server.

I'd like to change that so that users were allowed/denied access to the appliction/and controller actions/view based upon their AD roles instead, so they either auto-logged in (like Windows auth) or they get redirected to a "denied" page.

Any help very gratefully accepted...everything I find seems to be based upon Windows groups, or forms authentication.

like image 946
BlueChippy Avatar asked Feb 25 '23 02:02

BlueChippy


1 Answers

You could use the Roles property:

[Authorize(Roles = @"SOMEDOMAIN\somegroup")]
public ActionResult Foo()
{
    ...
}

Here's a tutorial which explains the steps.

like image 85
Darin Dimitrov Avatar answered Feb 27 '23 07:02

Darin Dimitrov