aspnetcore: IClaimsTransformation TransformAsync not working in asp.net core 3.0
IClaimsTransformation TransformAsync not getting hit in netcoreapp3.0
To Reproduce
Steps to reproduce the behavior:
- Using this version of ASP.NET Core ‘.3.0.0’
- Run this code ‘.’
public class ClaimsExtender : IClaimsTransformation
{
public ClaimsExtender()
{
}
public async Task<ClaimsPrincipal> TransformAsync(ClaimsPrincipal principal)
{
var x = "xxx";
}
}
When I Post a Request to my API, this TransformAsync method should always be hit.
This use to work in asp.net core 2.2
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 21 (6 by maintainers)
I was facing the same problem. I just move app.UseAuthentication(); before app.UseRouting(); and then TransformAsync was called without problem.
cc @HaoK can you take a look?
I was having the same problem,
services.AddAuthentication(IISServerDefaults.AuthenticationScheme);worked for me..net core 3.0 defaults to InProcess hosting model, ctrl-f “When hosting in-process, AuthenticateAsync” at this link: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/aspnet-core-module?view=aspnetcore-2.2