impersonation

Impersonation and asynchrony in ASP.NET WebAPI

随声附和 提交于 2019-12-21 11:57:06
问题 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 and asynchrony in ASP.NET WebAPI

我怕爱的太早我们不能终老 提交于 2019-12-21 11:56:08
问题 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.

LogonUser using LOGON32_LOGON_NEW_CREDENTIALS works against remote untrusted domain machine

蓝咒 提交于 2019-12-21 05:45:15
问题 So between the two machines, there is no trust - they are in different domains. I've successfully connected to the remote machine using LogonUser API using logon type, LOGON32_LOGON_NEW_CREDENTIALS . I am able to retrieve the content of a directory using the UNC share, and create a file stream to "download" the file. So far so good. The only issue is that it seems, LogonUser fails unless there is an already open session. Let me clarify that. I found that the ASP.NET MVC page was not working

Need Impersonation when accessing shared network drive

眉间皱痕 提交于 2019-12-20 04:06:39
问题 When I tried to access network drive file from local its working fine but when i deploy the code I am getting bellow error at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess

Error with windows impersonation code in webconfig file

我只是一个虾纸丫 提交于 2019-12-20 03:18:06
问题 I have the following section declared in the webconfig file to allow impersonation , I have shared the folder to public access within the network on the other machine <system.web> <compilation debug="true" targetFramework="4.0" /> <authentication mode="Windows"/> <identity impersonate="true" userName="******" password="*****"/> ......... .......... when i run the application its throwing error saying Configuration Error Description: An error occurred during the processing of a configuration

The account does not have permission to impersonate the requested user

半腔热情 提交于 2019-12-19 10:25:16
问题 I am getting this error while try to accessin the resource mailbox. pls any one help me on this . I am new to EWS. I am able to access the resource mailbox through OWA(Outlook web app). But i am not owner of this mailbox as it is shared mailbox. my code: ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack; ExchangeService newExchangeService = new ExchangeService (ExchangeVersion.Exchange2007_SP1); newExchangeService.Credentials = new NetworkCredential

The account does not have permission to impersonate the requested user

萝らか妹 提交于 2019-12-19 10:25:12
问题 I am getting this error while try to accessin the resource mailbox. pls any one help me on this . I am new to EWS. I am able to access the resource mailbox through OWA(Outlook web app). But i am not owner of this mailbox as it is shared mailbox. my code: ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack; ExchangeService newExchangeService = new ExchangeService (ExchangeVersion.Exchange2007_SP1); newExchangeService.Credentials = new NetworkCredential

Solution to avoid double-hop from client > web service > SQL Server

有些话、适合烂在心里 提交于 2019-12-19 09:02:38
问题 My project invoves a user connecting from client to web service, and then web service to SQL Server. The web services and SQL Server are on separate machines. Because of security requirements, we cannot used mixed mode in SQL Server, only Windows authentication. We are experiencing the "double-hop" issue between web service and SQL Server. We are using NTLM authentication and do not want to configure Kerberos because of the overhead and learning curve. We also don't want to have the web

Access CurrentUser Registry Key for Impersonated User - Compatibility with .NET 3.5

对着背影说爱祢 提交于 2019-12-19 04:12:47
问题 I've recently written an application that impersonate user account, get a handle to CURRENT_USER registry key (using PInvoke "LoadUserProfile" to retrieve ProfileInfo.hProfile object) and create registry key using RegistryKey.FromHandle. Reference code: using (WindowsImpersonationContext impersonatedUser = WindowsIdentity.Impersonate(hToken)) { using (SafeRegistryHandle safeHandle = new SafeRegistryHandle(hProfile, true)) { using (RegistryKey impersonatedUserHkcu = RegistryKey.FromHandle

get Current user context

给你一囗甜甜゛ 提交于 2019-12-19 03:06:09
问题 I've got problems with running a powershellscript from different locations (c# application, webservice...). I think it is a user context problem, so now I'm trying to find out under which user context powershell script is running. Is there any possibility log the current usercontext of the powershellscript? 回答1: If you need to know the actual user: [reflection.assembly]::LoadWithPartialName("System.DirectoryServices.AccountManagement") [System.DirectoryServices.AccountManagement.UserPrincipal