Set the AuthenticationResult via a new feature on the HttpContext
See original GitHub issueToday the authentication middleware resolved the AuthenticateResult
for the current request/endpoint and stores the Principal on the HttpContext but doesn’t store the other properties (Ticket, or AuthenticationProperties). Getting at these requires another call to AuthenticateAsync with the right scheme which can be a pain to get at. We should make this available via a feature on the HttpContext
Issue Analytics
- State:
- Created 3 years ago
- Comments:19 (19 by maintainers)
Top Results From Across the Web
authentication - ASP.NET Core - getting a message back ...
I have implemented a subclass of AuthenticationHandler . It returns AuthenticationResult.Fail("This is why you can't log in");. I would have ...
Read more >Access HttpContext in ASP.NET Core
The HttpContext instance is accessible by middleware and app frameworks such as Web API controllers, Razor Pages, SignalR, gRPC, and more.
Read more >Request Features in ASP.NET Core
The Features property of HttpContext provides access to the collection of feature interfaces for the current request. Since the feature ...
Read more >Custom Unauthorized response body - Ignas Sakalauskas
A quick example to illustrate an implementation of a custom Unauthorized response body in ASP.NET Core 2.1. The implementation is based on ...
Read more >Creating an authentication scheme in ASP.NET Core 2.0
How to make authentication handlers in ASP.NET Core 2.0, and walks through a naive implementation for HTTP Basic authentication.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We’ll need to rethink this change. Adding
AuthenticationTicket
to theIHttpAuthenticationFeature
creates a circular reference between Http.Features and Authentication.Abstractions.Idea (courtesy Chris): Using a DIM, we can add the Ticket to the
IHttpAuthenticationFeature
, then if the User is set by someone else the Ticket could be nulled out so we don’t have inconsistency with the two values, and we would remap the User to the Ticket.User.