ClaimsPrincipal, httpContext.User is not filled when I send the token, but endpoint is AllowAnonymos
So I am using minimal Apis and my endpoint looks like this
When I want to use this function on httpContext.User I always get null, even if I sent the token trough the header
I have CurrentUserService which I use and it looks like this
5 Replies
.AllowAnonymous()
is configuring your endpoint to allow unauthenticated users. Where you paraphs trying to configure authentication?Ok I understand that, but this needs to be anonymous endpoint, but if someone sends a token i want to treat it differently for authenticated user, can I place middleware or something to place claims from token to claim or no?
I don't think you get this behavior out of the box, but you can register a custom authorization filter/handler and achieve what you are looking for.
Thank you so much
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.