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
1
vote
1 answer

How to get the current IPrincipal in custom JsonConverter?

In my ASP.NET Web API application I'm building a custom JsonConverter to convert any DateTime string in Json objects to DateTimeOffset, using the logged in User's offset. I have read in this article that the IPrincipal is being reset during the…
Fred Fickleberry III
  • 2,439
  • 4
  • 34
  • 50
1
vote
1 answer

Get AuthorizeAttribute to work roles with start and expiration date in web api 2 application ?

I need to modify user roles in my web api 2 project using Identity 2 by adding additional properties: DateTime StartDate and DateTime EndDate. This is required to be able to grant users roles for a limited period of time. What do I need to do to get…
AunAun
  • 1,423
  • 2
  • 14
  • 25
1
vote
1 answer

How to implement role-based authorization in WPF application calling database through WCF services?

I have a WCF service that send queries to a database using stored procedure. The WCF services are called with a WPF application where role-based authorization is implemented with IIdentity and IPrincipal. I want to use this role-based security to…
Nat Acha
  • 169
  • 9
1
vote
0 answers

Creating a custom role principal to be used with custom role provider, How do I get IIdentity to pass as parameter?

I have a custom Role provider for my MVC4 application that is working so well in that it creates roles, checks role existence, check IsUserInRole but my [Authorize(Roles = "Admin")] is still using the default…
Jay
  • 3,012
  • 14
  • 48
  • 99
1
vote
1 answer

Web-API, DelegatingHandler and security. Principal is reset in Controller

I've a DelegatingHandler in my Web-API service that, based on the headers provided, set a custom IPrincipal (ServicePrincipal) on the Thread.CurrentPrincipal and on the HttpContext.Current.User. This is all done on a call to SendAsync. However, when…
Kieron
  • 26,748
  • 16
  • 78
  • 122
1
vote
3 answers

ASP.net web services

I am using a web service which sets the Thread.CurrentPrincipal object while logging in and soon later when another webmethod of the same web service accesses Thread.CurrentPrincipal, its different/resets Can someone tell me if this is expected or…
Sloane
1
vote
0 answers

.NET PrincipalPermission: Exception on mscorlib.dll

I am trying to implement security in my application. I made a project in visual studio to test this out. This works. This is the project to give you an idea of how I am using it…
Tim D'hoe
  • 33
  • 5
1
vote
0 answers

ASP .NET Custom Principal Overwritten

I had some code that sets the HttpContext.Current.User with a custom IPrincipal in an Application.AuthenticateRequest handler. This works fine and I've verified it's set correctly in the debugger...however, later down the pipeline when my WCF…
Jeff
  • 35,755
  • 15
  • 108
  • 220
1
vote
1 answer

WindowsPrincipal.IsInRole takes into account groups inside groups?

If I have an principal that pertains to a group that pertains to a group that pertains to a group that is added to the built it role "Administrator" will a call to principal.IsInRole(WindowsBuiltInRole.Administrator) return true?
Ignacio Soler Garcia
  • 21,122
  • 31
  • 128
  • 207
1
vote
1 answer

Custom IPrincipal expiration issue

I followed advice from this question on how to implement custom IPrincipal (I need it to store userId in it in order to reduce calls to database to get just userId). Now if I login to site and leave it about 20 minutes don't do anything on site and…
1110
  • 7,829
  • 55
  • 176
  • 334
1
vote
2 answers

Thread.CurrentPrincipal cannot be set to Forms Authentication principal

I have a WCF service, which is hosted inside of an ASP.NET MVC application (as described in http://msdn.microsoft.com/en-us/library/aa702682.aspx). Part of the MVC actions and WCF service operations are protected, and I use ASP.NET Forms…
Jonas Sourlier
  • 13,684
  • 16
  • 77
  • 148
0
votes
0 answers

ASP.NET Custom Pricipal and Cookies (tickets)

If i create a custom principal with five custom properties (example, phoneNumber), does the principal data get trasmitted inside of the cookie or does the data stay in the server? void MvcApplication_AuthenticateRequest(object sender, EventArgs e) …
Tony
  • 21
  • 4
0
votes
1 answer

User.Identity.IsAuthenticated returns false sometimes

Im using asp.net 4.0 and Form auth. To check if a user is authenticated or not, i use User.Identity.IsAuthenticated. Most of time it works perfect but i dont know how, sometimes it returns false even if user has auth. My web.config:
genesistr
  • 147
  • 2
  • 9
0
votes
1 answer

ASP.NET Core enrich IIdentity with custom profile

I am using Azure AD to authorize and authenticate the users. All users have a profile in the database. I would like on login to always "merge" the Azure user with my database user. This is the code I am using to setup authentication in my web…
Martin Andersen
  • 2,460
  • 2
  • 38
  • 66
0
votes
0 answers

How to implement server side blazor Custom Authorization Provider Correctly

I am trying to implement a basic custom Auth provider in my server side blazor project, but I am having some difficulty implementing the 'IsAuthenticating' property correctly. I used this site as my starter point, but it throws an error if…
1 2 3
8 9