public async Task Invoke(HttpContext context)
 {
     var handler = new ClaimsTransformationAuthenticationHandler(Options.Transformation);
     handler.RegisterAuthenticationHandler(context.GetAuthentication());
     try {
         if (Options.Transformation != null)
         {
             context.User = Options.Transformation.Invoke(context.User);
         }
         await _next(context);
     }
     finally
     {
         handler.UnregisterAuthenticationHandler(context.GetAuthentication());
     }
 }
        public async Task Invoke(HttpContext context)
        {
            var handler = new ClaimsTransformationAuthenticationHandler(Options.Transformation);

            handler.RegisterAuthenticationHandler(context.GetAuthentication());
            try {
                if (Options.Transformation != null)
                {
                    context.User = Options.Transformation.Invoke(context.User);
                }
                await _next(context);
            }
            finally
            {
                handler.UnregisterAuthenticationHandler(context.GetAuthentication());
            }
        }