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.

556 questions
80
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,665
  • 14
  • 79
  • 105
59
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,823
  • 10
  • 34
  • 67
36
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…
23
votes
4 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
  • 984
  • 2
  • 11
  • 31
17
votes
3 answers

add claims to access token keycloak

Below is my use case: I need to add a claim to the access token so that i can use it during policy evaluation on my resource. My policy is a javascript based policy and it gets access only to reserved and custom attributes of the logged in user. I…
Cshah
  • 5,612
  • 10
  • 33
  • 37
15
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
  • 201
  • 3
  • 4
15
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
  • 9,086
  • 16
  • 65
  • 106
15
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,131
  • 6
  • 16
14
votes
2 answers

How to retrieve Claims Value in .Net Core 2.0

As it says in the title I have already assigned claims to the registered user, I am now trying to retrieve the claim value when the user logs into the application within the UserClaims table in sql server which I find a bit difficult to do as this…
14
votes
1 answer

Where is http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name defined?

OASIS owns the http://schemas.xmlsoap.org/ws/2005/05/identity namespace, but I can't find anywhere that defines the "name" claim type. There are other claims like First Name, Last Name, Email Address, etc. but no claim that just refers to Name. Is…
Steven Padfield
  • 644
  • 1
  • 5
  • 12
14
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
  • 4,148
  • 3
  • 17
  • 34
14
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
  • 10,491
  • 3
  • 33
  • 40
14
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…
13
votes
2 answers

InvalidNameIDPolicy working with ADFS

I have many clients that uses SSO, for that we use SAML 2. Many of my clients uses providers like Okta, PingIdentity and a bunch of them ADFS. Doing the integration with ADFS always at the beginning raises this error when they came back with the…
wcpaez
  • 321
  • 1
  • 3
  • 9
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,497
  • 4
  • 54
  • 72
1
2 3
37 38