Questions tagged [iprincipal]

The System.Security.Principal.IPrincipal interface defines the basic functionality of a security object. It is most commonly used by applications written for the Microsoft.NET framework.

The System.Security.Principal.IPrincipal interface defines the basic functionality of a security object. This object represents the security context of the user on whose behalf the code is running, including that user's identity (IIdentity) and any roles to which they belong.

129 questions
4
votes
3 answers

Custom Principal reverting to GenericPrincipal on new requests

I'm trying to implement a custom principal and custom identity in a .NET MVC website. I've created a custom principal class which inherits from IPrincipal and a custom identity which inherits from IIdentity. When a user logs in I set both…
lancscoder
  • 8,658
  • 8
  • 48
  • 68
4
votes
3 answers

Code is ignoring PrincipalPermission attribute?

I have a Delete method on all my business objects that has the PrincipalPermission attribute on it. Example: [PrincipalPermission(SecurityAction.Demand, Role = "Vendor Manager")] public static bool Delete(Vendor myVendor) { …
Amanda Kitson
  • 5,477
  • 12
  • 49
  • 73
4
votes
1 answer

Pass IPrincipal from MVC to SignalR

I have a got an MVC application with forms based authentication with custom Principal. Before using application user must log in. After this I want to use SignalR, the issue is that Context.User.Identity.Name is always empty…
4
votes
1 answer

What set's the User.Identity.Name and User.Identity.IsAuthenticated?

I want to know what set's the user identity name and change isAuthenticatedto true. Why is User.Identity.Name an empty string and User.Identity.IsAuthenticated false after SignInManager.PasswordSignInAsync has returned Success. // POST:…
radbyx
  • 9,352
  • 21
  • 84
  • 127
4
votes
1 answer

Should User class implement IPrincipal and IIdentity

I'm building my own token based authentication for asp.net web api 2 and I have a question about the user class. Currently my user class implements IPrincipal and IIdentity, but I don't know what is the best practice. Would you divide IPrincipal and…
BendEg
  • 20,098
  • 17
  • 57
  • 131
4
votes
1 answer

Asp.NET Principal WebORB HttpHandler

I have a Flex-WebORB-Asp.NET application. When logging in, there's an AuthenticationHandler which implements a WebORB interface: IPrincipal CheckCredentials(string username, string password, Request message); So I create a Principal and return it.…
Lieven Cardoen
  • 25,140
  • 52
  • 153
  • 244
4
votes
2 answers

How to create a CustomPrincipal globally (with and without AuthorizeAttribute)

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 require Authentication. This works great for…
teleball
  • 4,602
  • 6
  • 37
  • 38
4
votes
2 answers

RoleProvider dosn't work with custom IIdentity and IPrincipal on server

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 IIS Express), it works currectly. But now, when I…
amiry jd
  • 27,021
  • 30
  • 116
  • 215
4
votes
1 answer

Can you wrap the RolePrincipal in a custom IPrincipal object?

I am using custom Membership and Role providers inside the ASP.NET framework with Forms Authentication. These are working great. The Role provider is using a cookie to persist the roles, saving a trip to the database on each web request. I am…
Keith Sirmons
  • 8,271
  • 15
  • 52
  • 75
3
votes
3 answers

File and Directory Security with IPrincipal

I need to gain access to the files and directories that the current IPrincipal has access to via the Directory.GetDirectories() and Directory.GetFiles() methods, without listing the other files. The process itself is running as NETWORK SERVICE, so…
Ben Laan
  • 2,607
  • 3
  • 29
  • 30
3
votes
1 answer

Store user id in Principal or Identity? ASP.Net/OpenID

I have an ASP.Net MVC web application using forms authentication. I am using OpenID for authentication. At the moment the moment I'm storing the openID url inside the Name of the standard GenericIdentity. I would also like to have easy access to the…
tpower
  • 56,100
  • 19
  • 68
  • 100
3
votes
1 answer

MVC2 :: How do I *USE* a Custom IIdentity Class?

I am trying to store a whole truckload of information about a user from a webservice. As this is information about the currently authenticated user, I thought it would make sense to store that information in a custom IIdentity implementation. The…
Scott Baker
  • 10,013
  • 17
  • 56
  • 102
3
votes
2 answers

ASP.NET MVC: How can IPrincipal be null?

I'm running a website on IIS6 / Server 2003 which uses Integrated Windows Authentication on a local intranet. I can browse to the site but get intermittent "Object null" errors when calling the following C# code, which is called on every…
Mark Robinson
  • 13,128
  • 13
  • 63
  • 81
3
votes
2 answers

The provided anti-forgery token was meant for user "UserName", but the current user is ""

When I am login with user's credential, first time no error while login to application, but when I logoff and again login with other user's credential got an error The provided anti-forgery token was meant for user "UserName", but the current user…
gaurav bhavsar
  • 2,033
  • 2
  • 22
  • 36
3
votes
0 answers

ASP custom forms authentication is not working because the cookie is lost

I have an ASP .Net 4.5 MVC website where I have customized the forms authentication following this tutorial. The difference is that I'm authenticating via a backend dll, so I have skipped all the database-stuff in the tutorial and where the tutorial…
1 2
3
8 9