您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

LuAuthMiddleware.cs 1.2KB

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Linq;
  3. using System.Reflection;
  4. using System.Threading.Tasks;
  5. using Microsoft.AspNetCore.Http;
  6. using Microsoft.AspNetCore.Mvc.Controllers;
  7. using Microsoft.AspNetCore.Mvc.Infrastructure;
  8. namespace Luticate2.Auth.Middlewares
  9. {
  10. public class LuAuthMiddleware
  11. {
  12. private readonly RequestDelegate _next;
  13. private readonly IActionDescriptorCollectionProvider _actionDescriptorCollectionProvider;
  14. public LuAuthMiddleware(RequestDelegate next, IActionDescriptorCollectionProvider actionDescriptorCollectionProvider)
  15. {
  16. _next = next;
  17. _actionDescriptorCollectionProvider = actionDescriptorCollectionProvider;
  18. }
  19. public async Task Invoke(HttpContext context)
  20. {
  21. // var items = _actionDescriptorCollectionProvider.ActionDescriptors.Items;
  22. // var item = items.FirstOrDefault();
  23. // var actionDescriptor = item as ControllerActionDescriptor;
  24. // if (actionDescriptor != null)
  25. // {
  26. //// actionDescriptor.MethodInfo.GetCustomAttributes()
  27. // }
  28. await _next.Invoke(context);
  29. }
  30. }
  31. }