0

I'm trying to use YARP proxy to intercept with requests that send a custom (external) UI component placed on our website. What I need is to get a token from the currently authenticated site user and add it to the proxied request. While proxy works fine, the user's identity below do not have any claims, therefore not authenticated. The UI component is being developed by another team.

The method below is an implementation of ITransformProvider from YARP. The question is - why httpContext has an empty collection of user's claims?

P.S. If I would use a regular API controller to accept requests from the UI component, then I had an access to all claims of the currently authenticated user.

public void Apply(TransformBuilderContext transformBuildContext)
{
    transformBuildContext.AddRequestTransform(async transformContext =>
    {
         var httpContext = _httpContextAccessor.HttpContext;

         if (httpContext.User?.Identity?.IsAuthenticated == true)
         {
             // not getting here
         }
    });
}

0 Answers0