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.
Ended up using [Authorize(Roles = "DOMAIN\\Group")]
in the controller which worked perfectly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With