question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Set the AuthenticationResult via a new feature on the HttpContext

See original GitHub issue

Today 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

cc @Tratcher @HaoK

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:19 (19 by maintainers)

github_iconTop GitHub Comments

1reaction
BrennanConroycommented, May 13, 2021

We’ll need to rethink this change. Adding AuthenticationTicket to the IHttpAuthenticationFeature creates a circular reference between Http.Features and Authentication.Abstractions.

1reaction
BrennanConroycommented, May 5, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found