I have a self hosted Web API in console project. I need to authroize the user on role based or domain based.
How can i achieve it.
Sample Code :
-- Here how can i implement the Authentication and authorization --
public class Sample : ODataController
{
[EnableQuery]
public IHttpActionResult Get(ODataQueryOptions<APINAME> opts)
{
}
}
You should use the both. In AD you set user groups and you assign specific permission to groups.
You need to keep in mind that users come and go but groups can stay definitely
I've worked on this kind of project 8 years ago.
We were in Windows Server environment, I was using CMD (MS DOS ICACLS)
In .Net or from Powershell or from MS DOS you can apply ACLs
Some resources
CACLS before ICACLS which seems more complex
An illustrations in Windows where you can see the changes you made
This other answer may help you