Questions tagged [principal]

This tag doesn't currently have an excerpt. Help contribute by writing one

173 questions
56
votes
3 answers

How should I check if a user is authenticated in MVC5?

I have seen the following two accessible booleans: System.Web.Mvc.Controller.User.Identity.IsAuthenticated System.Web.Mvc.Controller.Request.IsAuthenticated Is there a difference between these. They both seem to do the same thing so I am not sure…
user1679941
52
votes
3 answers

Keycloak retrieve custom attributes to KeycloakPrincipal

In my rest service i can obtain the principal information after authentication using KeycloakPrincipal kcPrincipal = (KeycloakPrincipal) servletRequest.getUserPrincipal(); statement. Keycloak principal doesn't contain all the information i need…
Alex
  • 1,515
  • 2
  • 22
  • 44
16
votes
1 answer

Thread.CurrentPrincipal in .NET console application

Here is a trivial console application that i run in command prompt: using System; using System.Threading; namespace Test { internal class Runner { [STAThread] static void Main(string[] args) { …
UserControl
  • 14,766
  • 20
  • 100
  • 187
16
votes
2 answers

How do I implement custom Principal and Identity in ASP.NET MVC?

I want to store extra information in the authenticated user so that I can have it easily accessible (like User.Identity.Id, for example), instead of just the name, since I'm planning on having that non-unique. So far I've gathered that I should…
Kenji Kina
  • 2,402
  • 3
  • 22
  • 39
13
votes
2 answers

How to get Email address from the principal in ASP.net?

I am trying to get the Email associated with the current user. The following shows few lines that I add Claims in authentication. public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context) { …
PCG
  • 2,049
  • 5
  • 24
  • 42
12
votes
1 answer

Spring security accessing principal

When using spring security, specifically with @notation; what is the proper way to access the principal in a Controller? Lets say the following is my controller, but I would like to access the principal in the secure() method…
wuntee
  • 12,170
  • 26
  • 77
  • 106
12
votes
2 answers

How I get Active Directory User Properties with System.DirectoryServices.AccountManagement Namespace?

I want do get Active Directory Properties from a user and I want to use System.DirectoryServices.AccountManagement. my code: public static void GetUserProperties(string dc,string user) { PrincipalContext ctx = new…
Tarasov
  • 3,625
  • 19
  • 68
  • 128
11
votes
2 answers

Retaining principal inside queued background work item

I'm using ASP.Net Web API 2 / .Net 4.5.2. I'm trying to retain the calling principal when queueing a background work item. To that end, I'm trying to: Thread.CurrentPrincipal = callingPrincipal; But when I do so, I get an…
user47589
10
votes
2 answers

How to get logged user name/Principal in Spring MVC REST channel?

I have Spring MVC REST channel: @Controller @RequestMapping("/rest") public class REST { and I have my method: @RequestMapping(value = "/doSomething") public @ResponseBody DoSomethingResultDTO doSomething( @RequestBody…
Danubian Sailor
  • 1
  • 38
  • 145
  • 223
8
votes
2 answers

UserPrincipal GetUnderlyingObject: properties missing

I'm trying to load the attribute physicalDeliveryOfficeName from a DirectoryEntry which is returned by the GetUnderlyingObject method of a UserPrincipal instance: DirectoryEntry directoryEntry = principal.GetUnderlyingObject() as…
Dänu
  • 5,791
  • 9
  • 43
  • 56
8
votes
3 answers

Spring 3 MVC Controller integration test - inject Principal into method

As part of Spring 3 MVC it is possible to inject the currently logged in user (Principle) object into a controller method. E.g. @Controller public class MyController { @RequestMapping(value="/update", method = RequestMethod.POST) public…
8
votes
1 answer

App Domain Level Impersonation

I am developing an application that needs to load plug-ins into separate child app domains. Only one plug-in is loaded into one child app domain. Each plug-in requires different Windows identity and those identities are different from the Windows…
user595010
8
votes
0 answers

SecurityContextHolder gives wrong User details

In my Application, We are capturing User details of each transaction from SecurityContextHolder Authentication object. But it gives wrong UserID it seems. Below are the code snippet for your reference. SecurityContext.xml spring-security-3.2…
8
votes
1 answer

How to understand Principals in SQL Server?

This sounds stupid but I find it really confusing: in MSDN the definition is the entity that can request SQL Server resources. And basically there are three types of principals: Windows-level principals, SQL Server-level principals and…
tete
  • 4,859
  • 11
  • 50
  • 81
8
votes
1 answer

How do I get the Current User identity for a VPN user in a Windows forms app?

We're currently developing a Windows Smartclient that needs to authenticate users using their AD group membership. We now have a requirement for some users to connect over VPN. Is there any way I can get the AD account identity and groups from the…
Andronicus
1
2 3
11 12