Just a thought. My current app is using integrated windows
authentication for SQL server and remoting portal, while using CSLA custom principal
as user in application context. So, you should be able to do the same.
On the other hand, you could create new AD groups to replace the old ones that
will contain users from companies A and B, while users of company A will retain
membership in old groups as well. That way, you can stay with Windows authentication
and just replace group names.
Sergey Barskiy
Senior Consultant
office: 678.405.0687 |
mobile: 404.388.1899
Microsoft Worldwide Partner of the Year | Custom
Development Solutions, Technical Innovation
From: ajj3085
[mailto:cslanet@lhotka.net]
Sent: Thursday, May 15, 2008 1:28 PM
To: Sergey Barskiy
Subject: [CSLA .NET] Roles.. any ideas?
Hi,
I currently have my application setup and built on Csla, and using
WindowsAuthentication. For security checks, I simply do an IsInRole call
on the Identity. The role permissions are hard-coded, something like
this:
private string[] allowedReadRoles = new string[] { "Sales",
"Ordering" };
I now need to brand my application, and while the roles will remain the same,
the problem is that IsInRole is functioning via group membership. The
branding will be for other companies, which are owned by the same owners, and
use the same office buildings, network and computers are the main company (the
other companies have less than 10 people).
So, adding the users for Company B to existing groups isn't really an option...
they'd have access to the application for Company A. I guess one option
is to switch to Csla authentication, but I'm currently using Integrated
Authentication for the remoting portal as well as database connections, so I'm
not sure that will work since I think I need the WindowsPrincipal on the
current thread for IA to work properly (or am I mistaken?).
Any other ideas? Has anyone used Authentication Manager, which allows you
to define real roles, not AD Groups?
Thanks
Andy
Yep. You can just create new groups specifically for your
CSLA app, and just change all the existing roles to new groups.
Sergey Barskiy
Senior Consultant
office: 678.405.0687 |
mobile: 404.388.1899
Microsoft Worldwide Partner of the Year | Custom
Development Solutions, Technical Innovation
From: ajj3085
[mailto:cslanet@lhotka.net]
Sent: Thursday, May 15, 2008 4:13 PM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] RE: Roles.. any ideas?
Hmm... I started looking into this, and the downside is that
I need to manage role membership in two places, since I use the Windows Groups
to map into database roles to control access to views / stored procedures.
ajj3085:Hi,
I currently have my application setup and built on Csla, and using WindowsAuthentication. For security checks, I simply do an IsInRole call on the Identity. The role permissions are hard-coded, something like this:
private static string[] allowedReadRoles = new string[] { "Sales", "Ordering" };
I now need to brand my application, and while the roles will remain the same, the problem is that IsInRole is functioning via group membership. The branding will be for other companies, which are owned by the same owners, and use the same office buildings, network and computers are the main company (the other companies have less than 10 people).
So, adding the users for Company B to existing groups isn't really an option... they'd have access to the application for Company A. I guess one option is to switch to Csla authentication, but I'm currently using Integrated Authentication for the remoting portal as well as database connections, so I'm not sure that will work since I think I need the WindowsPrincipal on the current thread for IA to work properly (or am I mistaken?).
Any other ideas? Has anyone used Authentication Manager, which allows you to define real roles, not AD Groups?
Thanks
Andy
The correct way for you to approach is is by adding another layer on top of your roles!!!
However a quick way around this problem for you is rather than using a static array of strings to hold your allowed roles create a Flags Enum of permissions and add Company A and Company B as options. You will then be able to assign company A / B as AD groups along with permissions. Then using bitwise operations you should be able to do what you are trying to do.
So when you load the roles, you add each to an enum using the following. You must ovveride the default is inrole along these lines
bool IsInRole(PermissionsEnum role){
if ((roles & role) == role) return true; else return false;}
PermissionsEnum permissions = PermissionsEnum.CompanyA | PerissionsEnum.Sales
Then to determine roles
if( identity.isinrole( PermissionEnum.sales)
{
//do general sales stuff
if( identity.isinrole( PermissionEnum.CompanyA)
{
Do specific company A sales stuff
}
}
Don't know if this helps you at all.
Copyright (c) Marimer LLC