コード例 #1
0
 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());
     }
 }
コード例 #2
0
        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());
            }
        }