Questions tagged [claims]

Claims were introduced in .NET4.5 to build Claims based authentication into the framework in the form of ClaimsIdentity and ClaimsPrincipal in the System.Security.Claims namespace.

Claims were introduced in .NET4.5 to build Claims based authentication into the framework in the form of ClaimsIdentity and ClaimsPrincipal in the System.Security.Claims namespace.

459 questions
78
votes
5 answers

MVC5 Claims version of the Authorize attribute

I'm trying out some of the new stuff in VS2013 RC with MVC5 and the new OWIN authentication middleware. So, I'm used to using the [Authorize] attribute to limit actions by role but I'm trying to use claims/activity based authorization, and I can't…
EightyOne Unite
  • 11,141
  • 12
  • 73
  • 102
56
votes
2 answers

Access Claim values in controller in MVC 5

I have used OWIN authentication in my application. Login Action var claims = new List(); claims.Add(new Claim(ClaimTypes.Name, result.UserFirstName)); claims.Add(new Claim(ClaimTypes.Sid, result.UserID.ToString())); var identity…
Golda
  • 3,449
  • 10
  • 31
  • 62
29
votes
1 answer

Custom Claim Handling Failed In Single Sign On

I am using the WSO2 Identity Server for Single Sign-On Implementations. In my demo applications, I am trying to get Custom claim attributes of authenticated Users from my own JDBC Database. I followed this blog of Pushpalanka. This worked fine for…
Tilakraj Jayswal
  • 401
  • 4
  • 10
19
votes
3 answers

How to get claim inside Asp.Net Core Razor View

I did it in my rc1 project like: User.Claims.ElementAt(#).Value But after I switched to rtm it wouldn’t work anymore. When I debug the Razor view the object looks the same but User.Claims is just empty. Any idea what the reason could be.
Sknecht
  • 789
  • 2
  • 10
  • 27
13
votes
1 answer

ASP.NET Identity: Update external claims after authorization

I am using ASP.NET Identity with several external login providers and I need to handle the following scenario: 1) A user logs in using an external service (let's say it is Facebook), application grabs some info from Facebook (first and last name,…
nativehr
  • 1,101
  • 6
  • 15
13
votes
1 answer

Best practices for creating custom claim types

Given a specific set of permissions, e.g. EditPage, CreateProject, ModifyUser, I am currently looking at two different ways of creating some custom claims types to model this behavior. I can find little information online about the best way to do…
mikesigs
  • 7,762
  • 3
  • 30
  • 37
12
votes
2 answers

Claims transformation support missing in ASP.NET Core 2.0

I am using JWT Bearer auth in my new asp.net core 2.0 api app and want to add some extra claims to the current identity. This extra info is located in another api which need to be queried. My understanding is that claims transformation would be the…
terjetyl
  • 9,067
  • 4
  • 52
  • 71
12
votes
2 answers

Efficiently check role claim

I'm developing an Asp.NET MVC5 web application (.NET 4.6) and I need to show some extra lines of HTML to a group of users with a specific claim. I've seen some verbose solutions but I prefer to keep it short, so I came up with this @{ if…
Naigel
  • 7,606
  • 14
  • 61
  • 96
12
votes
2 answers

Correct use of JwtTokens in C#

I'm playing a with JwtTokens and can't make them work properly. I'm using http://www.nuget.org/packages/System.IdentityModel.Tokens.Jwt/ for it. I know the code is a mess but is just to show what I'm trying to do. The problem is that I want the…
dariogriffo
  • 3,751
  • 1
  • 15
  • 31
12
votes
2 answers

Reuse Claim in regenerateIdentityCallback in Owin Identity in MVC5

I am using MVC5 with Owin identity. I am struggling to reuse any custom Claims in regenerateIdentityCallback. I have in Startup this configuration (as provided in the standard Template for new MVC project) app.UseCookieAuthentication(new…
Lukas K
  • 5,198
  • 4
  • 17
  • 27
12
votes
1 answer

MVC5 AntiForgeryToken Claims/"Sequence contains more than one element"

Case: I have an MVC5 application (basically the MVC5 template with a scaffolded view) with the Google authentication method enabled. The application has been configured to accept email as user name and to store the claims assigned from Google like…
12
votes
3 answers

Is there any way I can mock a Claims Principal in my ASP.NET MVC web application?

I've got some ASP.NET MVC controller code that checks if a user is authenticated and if so, it checks to see if it has a specific claim. Works fine. I've got some unit tests and I need to mock out an IPrincipal (which is easy to do) ... but I'm not…
Pure.Krome
  • 78,923
  • 102
  • 356
  • 586
11
votes
2 answers

What is difference between private and public claims on jwt

What is difference between private and public claims on jwt? I'm confused with the difference between those two claims. From what I understand they are both custom claims. So what is the difference?
NewDev
  • 161
  • 1
  • 4
11
votes
1 answer

Redirect loop with .Net MVC Authorize attribute with ADFS Claims

I have a problem configuring ADFS with my .Net MVC 5 app. I have configured my project in VS 2015 to use claims and it works ok, but I have an issue. I can sign in, ussing ADFS, I can check user roles etc. The problem occures when i try to use…
bunny1985
  • 700
  • 5
  • 20
10
votes
2 answers

(ClaimsIdentity) duplicate custom claims

From brockallen's article, He says that the "AuthenticateAsync() might be invoked multiple times" which could be the reason why the TransformAsync() is being called more than once (twice on my app). What I don't get is: When I construct…
gulp
  • 421
  • 3
  • 12
1
2 3
30 31