B
Bill Belliveau
Greetings
I am working on a project that can be configured to use Windows or Forms authentication. Occasionally the process may need to impersonate the calling user
Using Windows Authentication was fairly easy
-- ms code snippet -
System.Security.Principal.WindowsImpersonationContext impersonationContext
impersonationContext = ((System.Security.Principal.WindowsIdentity)User.Identity).Impersonate()
---
To handle a forms logon
-- code snippet -
IntPtr token = IntPtr.Zero
if(LogonUser(txtUserName.Text, txtDomainName.Text, txtPassword.Text
LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, ref token) != 0)
System.Security.Principal.WindowsImpersonationContext impersonationContext
impersonationContext = System.Security.Principal.WindowsIdentity.Impersonate(token)
Of course LogonUser requires that the process have “Act as part of the operating system†permissions, which by default the ASPNET process does not. My confusion comes from reading Microsoft’s patterns and practices, “Building Secure Microsoft ASP.NET Applicationâ€. LogonUser is mentioned many times and usually has a warning block stating the above issue and that the .NET Framework v1.1 will work around the issue by having the IIS process perform the logon instead. That doesn’t appear to be the case however. Can anyone confirm if a workaround was in fact implemented
Thanks
Bill
I am working on a project that can be configured to use Windows or Forms authentication. Occasionally the process may need to impersonate the calling user
Using Windows Authentication was fairly easy
-- ms code snippet -
System.Security.Principal.WindowsImpersonationContext impersonationContext
impersonationContext = ((System.Security.Principal.WindowsIdentity)User.Identity).Impersonate()
---
To handle a forms logon
-- code snippet -
IntPtr token = IntPtr.Zero
if(LogonUser(txtUserName.Text, txtDomainName.Text, txtPassword.Text
LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, ref token) != 0)
System.Security.Principal.WindowsImpersonationContext impersonationContext
impersonationContext = System.Security.Principal.WindowsIdentity.Impersonate(token)
Of course LogonUser requires that the process have “Act as part of the operating system†permissions, which by default the ASPNET process does not. My confusion comes from reading Microsoft’s patterns and practices, “Building Secure Microsoft ASP.NET Applicationâ€. LogonUser is mentioned many times and usually has a warning block stating the above issue and that the .NET Framework v1.1 will work around the issue by having the IIS process perform the logon instead. That doesn’t appear to be the case however. Can anyone confirm if a workaround was in fact implemented
Thanks
Bill