This thread was good because it helped clarify my thinking. There are 2 phases (for simplicity) where ClaimsPrincipal shows up:
- The authentication flow
- The authorization flow

Claims are typically used to store authentication data. #dotnet #aspnetcore 🧵👇🏾
That data is then used to look up more user information (profile data) usually store in a database/cache. This profile data usually also contains permissions and authorization rules are then run over this user for different types of application "resources".
These resources typically include (but are not restricted to):
- The HTTP endpoint
- Some business object

The authorization process usually needs access to all user profile information including permissions to do authorization checks.
ASP.NET's authentication system produces a
ClaimsPrincipal and the authorization system flows that ClaimsPrincipal to your code. This encourages users to put more things in claims as it's the only thing that flows in the first class way everywhere in the stack.
Putting more things in claims avoids more database round trips per request as the associated data is stashed at the protocol layer (the cookie, the JWT token etc). It increases the size of these tokens to avoid a potential database round trip per request.
This leads to people storing permissions in claims which makes doing authorization checks much easier as permission checks turn into checks for certain claims.
There's a philosophical debate about what should and should not be a claim and that leads to confusion.
The fact is, when the ClaimsPrincipal is used at the authentication layer, it's about the wire protocol. Data is read from the wire and turned into a ClaimsPrincipal and data is read from the ClaimsPrincipal and persisted back over the wire.
The ClaimsPrincipal is also used as an "exchange type" in .NET. It's the universal representation of an identity in the system so it's easy to pass it around everywhere.
So that leads us back to the original problem: Which user representation should developers be using for authorization checks? How does that user representation reach their authorization handlers?
This is what needs to be made clearer with docs and samples and possibly framework features.

Thanks for coming to my ted talk.
Thanks for the insights @BrockLAllen !

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with David Fowler 🇧🇧🇺🇸

David Fowler 🇧🇧🇺🇸 Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @davidfowl

Jun 27
COVID will be “over” when people stop posting tests results on Twitter. It’s not “normal” or “endemic” yet socially. It feels pretty inevitable at this point, there’s still a guilt associated with having it (you could have spread it unknowingly).
It’ll be “like the flu” and “normalized” socially when people stop doing that. So, IMHO Covid isn’t “over” yet…
As an example of what this “new normal” feels like: Hanging out with people and then waiting for 3-5 days to pass to see if you have any symptoms. Knowing you have to travel in a week and trying to reduce the possibility of getting it by reducing too much human infraction before.
Read 5 tweets
Jun 26
The oral history of Dave Cutler is a real gem:
Part 1:
Part 2:
Windows NT is a marvel of an operating system and his work has been immensely impactful on the industry at large. I also love that he's an engineer through and through.
Some gems:
- Engineers should care *deeply* about the quality of the code they write (he hated when he had bugs assigned to him).
- Coding != Software engineering. They brought strong engineering culture to Microsoft from DEC.
- Go interview elsewhere to know your worth😉.
Watching these luminaries, I see a pattern of small teams of highly capable people building largely impactful software projects.
Read 4 tweets
Jun 15
New feature that came out with minimal APIs in .NET 7 preview 5 (devblogs.microsoft.com/dotnet/asp-net…), the ability to declare parameter list surrogates: #dotnet #aspnetcore
You can refactor long argument lists into structs as a "zero cost abstraction". The struct's members will be bound as if they were parameters declared on the method.
It's not all or nothing, you can also do this with a subset of the parameters:
Read 5 tweets
Jun 15
Let me take you on my @msftorleans journey. Let's say you wanted to define a class that let callers subscribe to an event C#. It could look like this: #dotnet
This implementation uses C# events, but let's be a little more verbose and define the contract for subscribing and unsubscribing callbacks:
Now we store a list of Action for subscribers, and we mutate this list when there's a new subscriber or if one is being removed. Calling DoThing will call each subscriber sequentially.

Now lets make this a little more object oriented and Java like (no shade my java people):
Read 7 tweets
Jun 14
I thought this was common knowledge by now, but software engineers at “big tech” and in some of the major tech hubs in the US makes lots of money. I’d encourage you to look at levels.fyi to see the potential earnings at these companies. #techtwitter #BlackTechTwitter
That said this is about potential. This site doesn’t show how many people exists at these levels, let alone how many underrepresented people exist at some of these levels.
At Microsoft about 5.6% (query.prod.cms.rt.microsoft.com/cms/api/am/bin…) of the population is black and I know, just by looking around that there are a lot fewer in the upper echelons of levels. The percentages are more abysmal the further up the chain you go.
Read 4 tweets
Jun 12
Weekend tennis, opponent was too good today. Gotta put in more work, tournament season is coming up #tennis
Ran down this drop shot 💨
This was a great lob but a better overhead
Read 4 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(