I’m writing this article strictly because google do not have any obvious solutions in the hope it will be indexed and presented for fellow devs.
We use identity server and to make things easier in dev I want to stub it. ClaimsIdentity takes a second argument AuthenticationType. Its important you set this property. You can set it to what ever you like. Once set IsAuthenticated will return true.
if (env.IsDevelopment()) { app.Use(async (ctx, next) => { ctx.User = new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name, "local") }, "Authenticated")); await next.Invoke(); }); }