views:

54

answers:

2

Let's say we have an application that has a number of features and each feature as a permission set of users that are allowed to use that feature. The application is designed to be always-on, but at different times during the day we want different users to log on and use it.

Rather than reinvent the wheel and create yet another user account and password system, we'd like to use built-in Windows user accounts (for authentication) and Windows groups (for feature access).

Is it possible to leave the application running but have different users come along and log in and log out of the application without logging out of the Windows session?

A: 

Well, you could certainly have the application get the user's windows credentials. You could also simply query for group membership without requesting any credentials. More specific information will help with a more specific answer. For instance, what language are you working in?

EBGreen
+2  A: 

There is a mechanism called Impersonation (link points to .NET documentation, but the core Windows APIs provide similar features). It allows you to programmatically run code in a context of a different user than the one currently being logged in. There are, however, other security implications to the model you describe. In particular: how do you protect the rest of the workstation your program is running on?

Dirk
Thanks for the link - there is some great example code here: http://msdn.microsoft.com/en-gb/library/system.security.principal.windowsimpersonationcontext(VS.80).aspx.
saw-lau