Questions tagged [windows-identity]

Use this tag to better reference questions about WindowsIdentity allowing to encapsulate information about Windows accounts.

The WindowsIdentity object encapsulates information about Windows accounts. You use the WindowsIdentity object if you want to make authorization decisions based on a user's Windows account information.

For example, using WindowsIdentity and WindowsPrincipal objects, you can write an application that requires all users to be currently validated by a Windows NT or Windows 2000 domain. You can also allow certain domain accounts to access your application while denying access to others.

To find more information :

204 questions
0
votes
0 answers

HttpContextAccessor not returning logged in Windows User ID in ASP.NET MVC, what can be done?

How can you get the current logged in Windows user id using HttpContextAccessor in ASP.NET MVC controller? I tried to use HttpContextAccessor.HttpContext?.User.FindFirstValue(ClaimTypes.NameIdentifier) but doesn't return the User ID of the current…
EBrosas
  • 1
  • 1
0
votes
0 answers

WindowsIdentity.RunImpersonated not flowing across Task.Run

I have a situation where a (legacy) .Net Framework Web API needs to make an impersonated call into a separately-maintained .Net library. The call will perform a long running (~1 sec) operation, so it provides a method returning a Task for this…
0
votes
0 answers

ASP.NET MVC authentication type Windows

I get the current user account ok and manage to remove the domain charters from the output, please see below: In my HomeController's Index method: public ActionResult Index(string username) { ViewBag.UserName = User.Identity?.Name; …
jbcom41
  • 57
  • 1
  • 6
0
votes
1 answer

User Impersonation not working in .NET Core

We have a web app that runs on our corporate intranet. I get the following error when I try to access a network path in my MVC controller: Access to the path '\Server001\SharedFiles\CA' is denied. The App is hosted on IIS and app pool is set to…
0
votes
2 answers

How to Encrypt Windows Identity value?

I'm using x = System.Security.Principal.WindowsIdentity.GetCurrent().User.Value; which outputs the users windows identity. Here is an example of what the output looks like: S-5-2-51-37518325-1542148351-9136563645-5621 I'm currently sending this…
0
votes
1 answer

How to implement active federation provider with WIF

I have several Silverlight, WP7 and ASP.NET MVC client applications Most allow anonymous access to the application but secure various features based on a user's credentials when logged in. All of the clients use a common back-end service…
0
votes
1 answer

NLog "Input string was not in a correct format." using windows-identity

I am trying to log some information to database, but being kind of new to nlog config ( until now the default config from Tutorials worked fine) I am not sure what I am missing from my config to work. I get this error when I app starts 2022-02-24…
CiucaS
  • 2,010
  • 5
  • 36
  • 63
0
votes
1 answer

Using WindowsIdentity to connect to ManagementScope(WMI)

I have a .net core application that is hosted on IIS. This application utilizes System.Management to connect to other machines to gather information. I am noticing that some of my calls are getting an access denied response. The application pool is…
0
votes
0 answers

Why does testing the user's group membership not produce the expected result?

Please check the following code. WindowsIdentity identity = HttpContext.Current.Request.LogonUserIdentity; WindowsPrincipal principal = new WindowsPrincipal(identity); bool result = Principal.IsInRole("Active Directory Group Name"); if(result ==…
Bala Peddi
  • 11
  • 1
0
votes
1 answer

Overriding ASP.NET Core Windows Authentication Identity

I was looking to use Windows Authentication for a Blazor Server app, but hit a small issue with the default Identity Name. i.e. when you used Hi @context.User.Identity.Name I got back 'Hi DOMAIN\A123456', which…
0
votes
1 answer

ASP.NET User.IsInRole() with trusted-domain memberships

I have a .NET Framework 4.7.2 MVC 5 site that is using Windows Authentication to authorise access to actions based on AD group membership. This works fine for a single domain, but we have domain trusts in place and ASP does not seem to resolve…
SirKumbskull
  • 137
  • 2
  • 11
0
votes
1 answer

Is there a human-readable Windows user account ID that maps 1:1 with SID?

I need to pass a unique windows user account identifier between various processes (unique within the scope of a single computer running Windows 10 x64 1803 or higher). The account's SID is the natural choice, but opaque IDs make debugging painful,…
Scott Smith
  • 3,900
  • 2
  • 31
  • 63
0
votes
1 answer

C# ASP.Net Core - Passing Currently logged on Username to API

I want to pick up the user that is currently logged on to my web site, in an API on a different site. I do not want to pass the Username via a parameter for security reasons. In my REST API I have code like this: var userName =…
0
votes
1 answer

Obtain windows domain username and unique token/password to pass through service

I have an app that users would run locally on their desktop, which calls into an API on my server externally. I can obtain the user's Windows domain and name through the WindowsIdentity API. But I'd like to store a unique identifier/token on our…
mariocatch
  • 8,305
  • 8
  • 50
  • 71
0
votes
0 answers

Sending WindowsIndentity to a WebService

I'm trying to send a WindowsIdentity to a Web service, but I have a compilation error I don't understand. Here is a minimal reproducible example: The folowing method is on the web service: WindowsIdentity wi; [WebMethod] public void…
MrHeliose
  • 129
  • 8