Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Claims are missing in PreAuthorisationMiddleware in v16.0.0 #1258

Closed
danadesrosiers opened this issue Jun 4, 2020 · 4 comments
Closed

Claims are missing in PreAuthorisationMiddleware in v16.0.0 #1258

danadesrosiers opened this issue Jun 4, 2020 · 4 comments

Comments

@danadesrosiers
Copy link

Expected Behavior

In a PreAuthorisationMiddleware, the claims should exist on the ClaimsPrinciple on the HttpContext. This is needed for custom Authorization logic.

Actual Behavior

There are no Claims.

Steps to Reproduce the Problem

Using Ocelot 15.0.7, set up the pipeline with a custom PreAuthorisationMiddleware:

app.UseAuthentication();
var pipelineConfiguration = new OcelotPipelineConfiguration
{
    PreAuthorisationMiddleware = async (context, next) =>
    {
          var claimCount = context.User.Claims.Count();
          await next.Invoke();
    },
};

Value of claimCount is 13 (at least for my case).

Upgrade to Ocelot 16.0.0 and run again. Value of claimCount is 0.

Specifications

  • Version: 16.0.0, 16.0.1
  • Platform: .NET Core SDK (3.1.202)
@amweiss
Copy link

amweiss commented Jun 6, 2020

I believe this is the same as: #1252 it started in 15.0.7 for me.

@danadesrosiers
Copy link
Author

@amweiss, it does seem related, but this is working for me in 15.0.7, so maybe not the same issue.

@jlukawska
Copy link
Contributor

jlukawska commented Jun 30, 2020

Hello,
The breaking change in 16.0.0 was changing names ReRoutes to Routes (it should be changed in ocelot.json), but it shouldn't cause such problems I think.
I've tried to reproduce it basing on the code you showed but the claims exist in my case. Maybe you have (or can prepare) a full simple example of application with this problem?

@danadesrosiers
Copy link
Author

@jlukawska, thank you for taking the time to look into this. When I came back to this and attempted to reproduce the error, it was working this time. I'm not sure what was going on before, but I'm all set now. Sorry to waste your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants