Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AD Group authorisation in MVC5 web app

It was similar to the linked answer but I used the following syntax instead:

Ended up using [Authorize(Roles = "DOMAIN\\Group")] in the controller which worked perfectly

I have a web app, that I've completed now and the only things outstanding are to:

Upload to a web server; Make it so the site is only accessible to members of an AD Group.

I've been reading various articles and they all suggest different things. I have set the windows authentication up in the MVC and it will print out the userid on the banner in form of:

DOMAIN\Username

All I want to do now, is to pass through the AD group membership. If the user is in the group they can access the site, if they aren't they won't be able to view it.

I've tried this in the web.config, which I believe should work, but isn't in the test environment (VS 2013 Exp. for Web running iisexpress):

<authentication mode="Windows" />
<authorization>
  <deny users="?" />
  <allow roles="DOMAIN\Some Group"/>
</authorization>

Do I need a more complex method of doing this? At the moment I can still run and use the site despite not being in the specified AD Group.

like image 332
Amble Avatar asked Jun 05 '15 12:06

Amble


1 Answers

Ended up using [Authorize(Roles = "DOMAIN\\Group")] in the controller which worked perfectly.

like image 200
Amble Avatar answered Oct 11 '22 11:10

Amble