I have this in my startup:
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperE
You can add another middleware immediately after the UseAuthentication()
to add claims :
app.UseAuthentication();
app.Use(async(context, next)=>{
if(context.User !=null && context.User.Identity.IsAuthenticated){
// add claims here
context.User.Claims.Append(new Claim("type-x","value-x"));
}
await next();
});
// call other middlewares
app.UseMiddleware();