iprincipal Questions

2

I am trying to validate the user is in the "TestGroup" group or not. The user is part of the "TestGroup" group, even i am getting the retval = false @line(retVal = user.IsMemberOf(groupPrincipal);)...
Rooseveltroost asked 25/8, 2014 at 17:17

1

Given I create a claims identity and subsequently a principal. Then I serialize the principal. Inspecting the json string I can confirm that the "Role" claim is there as well as the identity. Dese...
Oof asked 24/1, 2018 at 14:38

9

Solved

I need to do something fairly simple: in my ASP.NET MVC application, I want to set a custom IIdentity / IPrincipal. Whichever is easier / more suitable. I want to extend the default so that I can c...
Graveclothes asked 30/6, 2009 at 15:18

3

Solved

I am trying to inject IPrincipal into my SignalR hub constructors. I already saw and tried the solution from "Selective IPrincipal Injection via StructureMap with SignalR", but unfortunately that d...
Atmospheric asked 15/12, 2014 at 12:47

4

Solved

So, what is the purpose for existence of both IIdentity and IPrincipal, and not some IIdentityMergedWithPrincipal? When is it not enough to implement both in same class? Also, to understand purpos...
Superorder asked 24/11, 2014 at 15:4

4

Solved

I trying to add custom properties to the ApplicationUser for a web site using MVC5 and OWIN authentication. I've read https://mcmap.net/q/63665/-asp-net-mvc-set-custom-iidentity-or-iprincipal and I...
Enrich asked 10/2, 2014 at 14:28

2

Solved

My unit tests for an ApiController uses some helpers methods to instantiate the controller: public static ResourcesController SetupResourcesController(HttpRequestMessage request, IResourceMetadata...
Levon asked 14/3, 2013 at 15:42

1

What is Thread.CurrentPrincipal used for? How does it help in the Authentication and Authorization of an application? Are there any articles or resources that help explain what it does?
Vintner asked 22/1, 2016 at 19:36

0

Basically I am trying to get the current set of claims for an authenticated user (via bearer token) currently accessing a Web Api; by injecting the current principal into a helper class, which is t...
Microstructure asked 22/9, 2014 at 21:40

1

With WIF (Windows Identity Foundation) 4.5, Microsoft created the WindowsPrincipal class, which is a type of ClaimsPrincipal. Of course, these classes aren't portable, but the interfaces behind the...

3

Resharper 8 running in VS2010 is telling me I can remove a check for principal.Identity != null: I'm assuming this is because there's a NotNull attribute or something lurking in the code for IPr...
Omniscience asked 5/12, 2013 at 12:26

3

Solved

I have a WCF service which has its Thread.CurrentPrincipal set in the ServiceConfiguration.ClaimsAuthorizationManager. When I implement the service asynchronously like this: public IAsyncResult ...
Awlwort asked 8/1, 2014 at 23:8

2

Solved

I have a custom Principal/Identity for my ASP.NET MVC4 web app. I have also created a AuthorizeAttribute to instantiate my custom principal, assigning it to httpContext.User in controllers where I ...
Unlisted asked 13/7, 2012 at 18:33

2

Solved

I'm using a custom IIdentity and IPrincipal in my ASP.NET MVC application via EF 4.3 as expalined here (and follow accepted answer's solution). Also, I have a custom RoleProvider. In local (using I...

5

Solved

I try to implement ASP.NET Authentication and Authorization on top of our existing database. We have a website calling a webservice to fetch its data. To use the webservice, i need to provide the u...

1

I need to access the currently logged in user in my action filter. The identity is set by a DelegatingHandler further up the chain of execution. I can access the current IPrincipal using Htt...

1

I'm doing some Active Directory work with .NET's System.DirectoryServices.AccountManagement namespace. I noticed that Principal implements IDisposable, which causes sort of a headache since everyth...
Laciniate asked 12/2, 2013 at 21:7

5

Solved

I have the following ntier app: MVC > Services > Repository > Domain. I am using Forms authentication. Is it safe to use Thread.CurrentPrincipal outside of my MVC layer to get the currently logged ...

3

Solved

I'm using LINQPad to test code (what a great product, I must say) but now I'm encountering an exception when I try to set the Thread.CurrentPrincipal to a custom IPrincipal that is marked with the ...
Koffman asked 13/7, 2012 at 14:2

6

I've written a custom principal object which contains a few additional fields (email and userid in addition to the username). In order to access these properties I have to cast the Context.User ob...
Circumvent asked 12/8, 2011 at 18:7

1

Solved

StructureMap is configured to inject HttpContext.Current.User when an IPrincipal is requested for any ASP.NET MVC web request, like so: For<IPrincipal>().Use(x => HttpContext.Current.User...

1

Solved

I create my own IPrincipal and IIdentity implementation as shown below: [ComVisible(true)] [Serializable] public sealed class CustomIdentity : IIdentity { private readonly string _name; private...

2

Solved

Despite the fact that I've been on here for a while, this is my first ever question on SO, so please be gentle with me. I'm using ASP.NET MVC 3 and I want to create a custom Principal so I can sto...

1

Solved

I have seen the following two example for injecting the User IPrincipal: Method 1: kernel.Bind<IPrincipal>() .ToMethod(context => context.Kernel.Get<RequestContext>().HttpContext....
Skiing asked 24/10, 2011 at 14:43

1

This should be simple, but I simply cannot figure it out after all my googling. Here's what I want. I have a custom Users table (no roles at the moment) that I'd like to authorize against. For this...
Burgundy asked 21/8, 2011 at 18:12

© 2022 - 2024 — McMap. All rights reserved.