K2ROM and security contexts

  • 1 November 2007
  • 1 reply
  • 2 views

Badge +5

Scenario: User is running on a machine that is logged in as MACHINE.  User authenticates (in custom software) to Directory Services as Fred.  User then wants to connect to K2 and retrieve a worklist via custom software/K2ROM.

So in code, I've got an IPrincipal (which contains an IUser) for Fred's security context.  But K2ROM's Connection.Open can either connect as the current user (MACHINE) or via a connection string that includes a password (which I don't have).

How do I connect to K2 as Fred?  (Capturing and storing the password is not an acceptable solution.)

Does this require impersonation?

TIA,

Bill 


1 reply

Badge +9
Assuming the backend is Active Directory, yes, you'll probably need to impersonate based upon the usertoken,  Once the context has been impersonated, you can then call the K2ROM Open with no connection string.  Once the operation is complete you can then call the Undo() method of the WindowsIdentity.Impersonate class to revert back to the original user. 

Reply