Impersonation is a process whereby an application assumes another identity or security context during execution.
Questions tagged [impersonation]
1522 questions
6
votes
0 answers
How Can I Sandbox my Process?
Problem
I'm creating a Windows server program that is potentially quite vulnerable to attacks. I'd like to sandbox (jail?) it or at least run my process in very low integrity setting. I probably be happy with just starting the process…

user3800024
- 61
- 1
6
votes
3 answers
Calling an async WCF Service while being impersonated
I have a WCF Service running on a Server, which is configured to accept Kerberos authentication.
Kerberos works fine and the WCF Service therefore knows, which user is connecting to him.
The Service offers everything as Async Methods. Like this here…

TGlatzer
- 5,815
- 2
- 25
- 46
6
votes
2 answers
passing code to a function as parameter within "using statement"
This code works fine with me:
[DllImport("advapi32.dll", SetLastError = true)]
public static extern bool LogonUser(string lpszUsername, string lpszDomain, string lpszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken);
…

CrownFord
- 709
- 5
- 15
6
votes
2 answers
How to debug as NT AUTHORITY\SYSTEM in Visual Studio?
I'm trying to debug as NT AUTHORITY\SYSTEM. I've tried to use the methods described in the following question:
RunAs A different user when debugging in Visual Studio
Yet, what credentials do I need to use in order to pass through authentication?

MichaelS
- 7,023
- 10
- 51
- 75
6
votes
1 answer
Checking impersonation in SQL Server
I have several DBs with UserA and UserB.
In some of those DBs, impersonation has been granted (GRANT IMPERSONATE ON LOGIN::UserA TO UserB), in other DBs users have no impersonation.
How can I check with a query if a user has got the impersonation or…

Impwins
- 63
- 1
- 4
6
votes
2 answers
Given a username and password, how do you impersonate that user elevated?
In Windows Vista and later, LogonUser returns a non-privileged token, even if the user provided is an administrator. Thus, when you impersonate using that token, you are non-elevated. Given a correct username and password for an administrator user,…

Mark Raymond
- 906
- 8
- 22
6
votes
1 answer
Why do Thread.CurrentPrincipal.Identity and WindowsIdentity.GetCurrent() differ when impersonation is turned on?
I enabled impersonation and Windows authentication.
But Thread.CurrentPrincipal.Identity.Name returns the name of authenticated user and…

Pavel Voronin
- 13,503
- 7
- 71
- 137
6
votes
1 answer
What is the magic to Windows impersonation with LOGON32_LOGON_NEW_CREDENTIALS?
From my reading on user impersonation on Windows, one should properly use the LOGON32_LOGON_NEW_CREDENTIALS logon type for impersonating a user to a database. Using Matt Johnson's nice impersonation wrapper (originally posted here and then polished…

Michael Sorens
- 35,361
- 26
- 116
- 172
6
votes
2 answers
Impersonation succeeds but database connection fails
I have C# (.NET 4.5) code like this (simplified for demonstration) used to connect to a SQL Server 2012 database:
public static void Test(WindowsIdentity ident)
{
using (WindowsImpersonationContext ctx = ident.Impersonate())
{
using…

JTennessen
- 315
- 3
- 13
6
votes
1 answer
Impersonate google user with a service account
I'm using google-api-php-client 0.6.1 and I'd like to know is there a way to impersonate concrete user with service account? My application needs to store some files in its google drive. So, I've decided to user service account and .p12 key -…

user2134179
- 61
- 1
- 2
6
votes
0 answers
Is it possible to run Console Application under LocalSystem Account?
Is it possible to run Console Application under LocalSystem Account programmatically in C#?
If yes, how can i do it ?
If not, why not ?
thanks

Esat Yilmaz
- 71
- 1
- 4
6
votes
1 answer
How to enable a user for impersonation in Tridion 2009?
I'm trying to use Tridion's ContentManagment API to retrieve taxonomy categories and keywords, but I'm running into an Access denied error.
I have the following method:
public Dictionary GetKeywords(string tcmUri)
{
var result =…

James Simm
- 1,569
- 1
- 16
- 28
6
votes
3 answers
Can you perform an impersonated search in SharePoint without providing a password?
I have done impersonation in SharePoint quite a bit in the past by doing something such as the following.
SPWeb web = SPContext.Current.Web;
string currentWebUrl = web.Url;
SPUser user = web.EnsureUser(loginToImpersonate);
using (SPSite site = new…

Kirk Liemohn
- 7,733
- 9
- 46
- 57
5
votes
1 answer
Team Foundation Server - Application Tier to Data Tier: Authentication, Impersonation and Authorisation
According to the Team Foundation Server Architecture document, in the Groups and Permissions section:
Team Foundation Server has its own set of default groups and permissions that you can set at the project, collection, or server level. You can…

Rabid
- 2,984
- 2
- 25
- 25
5
votes
1 answer
How to run a separate process as a domain user with a 'local system' service?
I have this following simple service program:
using System.Diagnostics;
using System.ServiceProcess;
namespace BasicService
{
public partial class Service1 : ServiceBase
{
public Service1()
{
…

ymerej
- 727
- 1
- 8
- 21