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
70
votes
8 answers

How do I get the currently-logged username from a Windows service in .NET?

I have a Windows service which needs the currently logged username. I tried System.Environment.UserName, Windows identity and Windows form authentication, but all are returning "System" as the user my service is running as has system privileges. Is…
Raj
  • 3,890
  • 7
  • 52
  • 80
35
votes
2 answers

How do I perform WIF/claims impersonation without the claim being mapped to an AD account?

I need to perform search impersonation in SharePoint 2010 for Claims users. To put this in context, I would like to first state how I get this to work with Windows accounts and then discuss Claims / WIF. Windows Accounts I can do this for "classic"…
Kirk Liemohn
  • 7,733
  • 9
  • 46
  • 57
31
votes
4 answers

How can I retrieve all the roles (groups) a user is a member of?

Is there a way to get a list of roles a Windows authenticated user is in, without explicitly checking by WindowsPrincipal.IsInRole method?
muratgu
  • 7,241
  • 3
  • 24
  • 26
24
votes
8 answers

How do I get the currently loggedin Windows account from an ASP.NET page?

I have an ASP.NET 3.5 application that uses ASP.NET forms authentication. I want to be able to get the Windows user name currently logged into the computer (NOT logged into the ASP.NET application, but into Windows) when data is edited in a page. If…
StackTrace
  • 9,190
  • 36
  • 114
  • 202
22
votes
2 answers

ADAM, Active Directory, LDAP, ADFS, Identity

What is the difference/relation between ADAM, Active Directory, LDAP, ADFS, Windows Identity, cardspace and which server (Windows 2003, Windows 2008) uses what?
kayak
  • 1,805
  • 5
  • 18
  • 22
22
votes
3 answers

How to create WindowsIdentity/WindowsPrincipal from username in DOMAIN\user format

The WindowsIdentity(string) constructor requires the username to be in username@domain.com format. But in my case I get the usernames from a DB in the old DOMAIN\user format (and then have to check their Windows role membership). What is the best…
Knaģis
  • 20,827
  • 7
  • 66
  • 80
17
votes
1 answer

What is difference between identity provider vs federation provider?

I have been reading some article on Windows Identity foundation and there are some vague definitions on federation provider(may be my understanding is not accurate). However I didn't come across one article which dilettantes between Identity…
Lost
  • 12,007
  • 32
  • 121
  • 193
14
votes
4 answers

Can WindowsIdentity.GetCurrent() return null?

ReSharper warns me about a possible NullReferenceException in WindowsIdentity windowsIdentity = new WindowsIdentity(WindowsIdentity.GetCurrent().Token); I looked in MSDN doc but didn't see any mention of this. Also, it doesn't make sense since if…
Noich
  • 14,631
  • 15
  • 62
  • 90
13
votes
9 answers

HttpContext.Current.User.Identity.Name returns blank

I am using HttpContext.Current.User.Identity.Name to get the user name when the web application is in use. During development I was using my local iis, with integrated windows authentication enabled and anonymous access enabled and disabled, and I…
Andy5
  • 2,319
  • 11
  • 45
  • 91
12
votes
2 answers

User.Identity fluctuates between ClaimsIdentity and WindowsIdentity

I have an MVC site that allows logging in using both Forms login and Windows Authentication. I use a custom MembershipProvider that authenticated the users against Active Directory, the System.Web.Helpers AntiForgery class for CSRF protection, and…
Guy Passy
  • 694
  • 1
  • 9
  • 32
12
votes
1 answer

How to setup OWIN with Windows authentication and a custom role provider

In MVC4 I enabled in the web.config and created a custom role provider which then would automatically wrap the WindowsIdentity with a RolePrincipal for you. Worked like a charm. How would you do this in MVC5 using…
batkuip
  • 1,480
  • 3
  • 15
  • 25
12
votes
2 answers

MVC3 Windows Authentication override User.Identity

I am building a intranet application using MVC3 with a MSSQL backend. I have authentication and roles (through a custom roles provider) working properly. What I am trying to do now is overriding User.Identity to allow for items like…
11
votes
7 answers

How do I get the current windows user's name in username@domain format?

I know that the following function returns the current Windows user's name in domain\username format. Convert.ToString( WindowsIdentity.GetCurrent().Name ); But how do I obtain the user's name in username@domain format? EDIT: I'm responding in…
Tony Vitabile
  • 8,298
  • 15
  • 67
  • 123
9
votes
4 answers

WIF- ID1014: The signature is not valid. The data may have been tampered with

I've been using WIF to authenticate our new website, the STS is based upon the starter-sts implementation. To enable this to work correctly on out load balanced environment I've used the following in the global.asax to override the default…
RubbleFord
  • 7,456
  • 9
  • 50
  • 80
8
votes
1 answer

Create WindowsIdentity using just a domain and username

I am building a site that gets user information using the WindowsIdentity of the current user. The main info I get from this is the ssid. I do this for the current users as follows IntPtr logonToken =…
Matt
  • 4,140
  • 9
  • 40
  • 64
1
2 3
13 14