nventive / DotNet.Backend.Template

.NET Core Templates for backend applications and open-source components.
Apache License 2.0
7 stars 3 forks source link

Fix operation context #28

Closed baptiste-nv closed 3 years ago

baptiste-nv commented 3 years ago

GitHub Issue: # NA

Proposed Changes

Bug fix

What is the current behavior?

OperationContext middleware is set too early when using authentication, causing the Principal identity to be null.

What is the new behavior?

Move

app.UseMiddleware<OperationContextMiddleware>(); 

after the call to

app.UseAuthentication()
      .UseAuthorization();

Checklist

Please check if your PR fulfills the following requirements: