impersonation

Programmatic Impersonation Delegation For Remote Resources (Double-Hop)

十年热恋 提交于 2019-12-04 18:37:38
I am having a hard time to get Runtime Impersonation to work. Scenario: Anonymous access is disabled in all servers, and windows auth is enabled Client calls Web Api 1 Web Api 1 may call Web Api 2, or the oData Service Call from Web Api 1 to Web Api 2 needs to be impersonated with the Client Credentials Calls from Web Api 1 to oData Service must not be impersonated Web Api 1 calls both the service using Web Request We have Kerberos delegation configured properly What Works (Kinda): If I turn on impersonation in Web Api 1 using the Web.config <authentication mode="Windows"/> <identity

ASP.NET PowerShell Impersonation

故事扮演 提交于 2019-12-04 12:57:24
问题 I have developed an ASP.NET MVC Web Application to execute PowerShell scripts. I am using the VS web server and can execute scripts fine. However, a requirement is that users are able to execute scripts against AD to perform actions that their own user accounts are not allowed to do. Therefore I am using impersonation to switch the identity before creating the PowerShell runspace: Runspace runspace = RunspaceFactory.CreateRunspace(config); var currentuser = WindowsIdentity.GetCurrent().Name;

how to implement Kerberos protocol transition in Java? (S4U2Self)

拈花ヽ惹草 提交于 2019-12-04 12:48:27
Edit Now I know what I need. I need to implement Kerberos protocol transition (S4U2Self) in Java. There are examples in .Net, but none for Java. There is this third party library Quest Single Sign on for Java that claims to do that. I've downloaded the JAR and it looks good, but I would rather use a custom implementation instead of someone else's code (which have to be paid). Can anyone give any head start on what needs to be done? Any existing open Java API to handle this? Thanks Question before At the moment my application only knows the user id, and I need to authenticate that user with

Impersonate a membership user in ASP.NET

跟風遠走 提交于 2019-12-04 12:02:59
问题 In a generic asp.net website with Membership , Roles and hashed passwords enabled, I would like to provide the administrators with impersonation so that they may browse the website as that user would. The website should function as if that user is logged on and then be able to revert to their own login. What is the best approach to achieve this? An example use-case: A website with two types of users: 'Buyer' and 'Admin'. The website provides a 'Purchase' button to buy something specifically

WindowsImpersonationContext & Impersonate() not found in ASP.Core

本秂侑毒 提交于 2019-12-04 11:39:07
问题 I had the following in a .NET Framework 4.0 assembly: var newId= new WindowsIdentity(duplicateTokenHandle); WindowsImpersonationContext newId = ImpersonatedIdentity.Impersonate(); I'm porting it to ASP.Core, but WindowsImpersonationContext and WindowsIdentity.Impersonate() aren't found. I've tried adding the following: System.Security.Claims 4.3.0 System.Security.Principal 4.3.0 System.Security.Principal.Windows 4.4.0 How do I perform impersonation in ASP.Core? Update It looks like it's not

Is it possible to impersonate a user without logging him on?

亡梦爱人 提交于 2019-12-04 03:47:05
Is it possible to impersonate a user without supplying user name/password? Basically, I'd like to get the CSIDL_LOCAL_APPDATA for a user (not the current one) using the ShGetFolderPath() function. All I currently have is a SID for that user. No, you have to call Win32 API LogonUser function to get windows account token back so you can then impersonate. You can impersonate a user without supplying password by calling ZwCreateToken. See the CreatePureUserToken function in this article: GUI-Based RunAsEx You must be running as an admin (or LocalSystem) for this to work. Another technique is to

SQL Server Execute Impersonation

余生颓废 提交于 2019-12-04 03:44:58
What is the diffrence between... execute as user = 'testuser' AND execute as login = 'testuser' I am executing a cross database procedure under these logins and it works with the exececute as login but not the execute as user. It is saying the server principal "testuser" is nt able to access the database "xxx" under the securty context. When i SELECT SYSTEM_USER after both commands I see that it is set to 'testuser' execute as login provides impersonation to the entire server, since logins are on a server level. Since users are defined per database, execute as user impersonation applies only

Impersonation and asynchrony in ASP.NET WebAPI

无人久伴 提交于 2019-12-04 03:36:58
Update 2 This question originally was "Does impersonation work with Web API?" And the question to that question is "Yes, it does." But the problem was not about Web API but impersonation itself. (The description of the problem is below) But now I'd like to tell others about the solution. My controllers are async and my mistaken premise was that any thread spawned by impersonated thread has the same identity as its parent. By default it is false: TPL does not flow impersonation across threads. Impersonation flow can be enabled either programmatically or in configuration . Note, please, that

Impersonate SYSTEM (or equivalent) from Administrator Account

[亡魂溺海] 提交于 2019-12-03 22:12:27
问题 This question is a follow up and continuation of this question about a Privilege problem I'm dealing with currently. Problem Summary: I'm running a program under a Domain Administrator account that does not have Debug programs (SeDebugPrivilege) privilege, but I need it on the local machine. Klugey Solution: The program can install itself as a service on the local machine, and start the service. Said service now runs under the SYSTEM account, which enables us to use our SeTCBPrivilege

How to pass impersonated user in Web API call from Console App with Windows Authentication?

。_饼干妹妹 提交于 2019-12-03 21:44:57
I have a Console App and a Web API 2 project, both run on the same server. I have setup my Console App to call a RESTful endpoint in my Web API using HttpClient while impersonating a domain account. Console.WriteLine("Setting up impersonator."); using (new Impersonator(accountUsername, accountDomain, accountPwd)) { Console.WriteLine("Impersonator set up."); HttpClientHandler handler = new HttpClientHandler(); handler.UseDefaultCredentials = true; Console.WriteLine("Executing as: " + System.Security.Principal.WindowsIdentity.GetCurrent().Name); using (var client = new HttpClient(handler)) {