views:

294

answers:

1

Hi,

I've just started a small ASP.NET web application. In this project, I need to authenticate the users with Active Directory. I managed to authenticate the users successfully with Active Directory. But with Authorization with Custom Role Provider, I'm so confused. You see, the user name and password are stored in AD. So, my approach is that after the LoggedIn event of the Login Control, I check if UserName is not yet stored in the Users table yet, then I will store the UserName there. Finally, I have all the UserName of the AD users store in the Users table so I can assign Roles to the users. Please see my tables diagram below:

alt text

Let's say I assign UserA to RoleOne. After he logs in successfully, I do some query to look for his Roles.

Where do I keep the Role ticket? In the Cookie or in the session? How does the authorization of ASP.NET role provider work? I want to store the authorization ticket like ASP.NET role prover does too.

A: 

Have you considered using Active Directory groups for roles and the WindowsTokenRoleProvider (or a custom role provider accessing AD)? I find that this works very well for a situation where you're using AD for authentication as well. One tip: use cookies to store the user's roles so you don't have to find them on every request.

tvanfosson
The project requirement needs to use AD for authentication and use DB table for authorization. Cookies is good place for authorization. I'm just concerned about the security. If I use Cookies for this, I think I will have to check it on every page request or I don't have to?
Angkor Wat
The cookie should be encrypted. When you set up the RoleProvider you can specify to use cookies to hold the roles. If you use cookies, then it automatically retrieves the roles from the cookie instead of using the provider, if the cookie is available. I believe they are session cookies. You can secure them using SSL in addition to encrypting them if necessary.
tvanfosson