I'm looking for the best way to secure access to the data stored into an SQL Server database (accessed via stored-procedures).
Company's users are split into 3 entities with associated Windows security groups: G_SUBSIDIARY1
, G_SUBSIDIARY2
, and G_HOLDING
.
Each application is associated with a Windows security group: G_APPLICATION1
, G_APPLICATION2
, G_APPLICATION3
...
These security groups are mostly used to control access to shared folders dedicated to each entity and application.
The stored-procedures should filter data depending on who request them.
As an example to access data in table APPLICATION1_DATA
you must be a member of group G_APPLICATION1
.
And depending on your entity you will access a different subset of the data (discriminator is a column with the entity to which the data belongs).
To apply authorization I was thinking of relying only on Windows security groups and checking with the IS_MEMBER
function if the current user (authenticated via Windows authentication) belongs to each: IS_MEMBER("COMPANY\G_APPLICATION1")
and IS_MEMBER("COMPANY\G_SUBSIDIARY1")
.
The main advantages I see is that there is only one object to manage, and if later users are added or removed this is transparent on the database side.
But I wonder if there is any drawbacks with this method, and if on the contrary there would be some advantages to use SQL Server roles in addition to these security groups.
It would add some maintenance to keep them up-to-date but it might be worth it...