title: How can I get route attributes dotnet core 3?
body: <p>I have upgraded dotnet core 2.2 to 3.preview 7.<br>
  So after that, I can't get custom attributes.<br>
  <code>context.Resource</code> in version 2.2 was type of <code>AuthorizationFilterContext</code>, but in version 3 is type of <code>Microsoft.AspNetCore.Http.Endpoint</code>.  </p>
  
  <p>Now I couldn't get attributes from endpoint.</p>
  
  <pre><code>using Microsoft.AspNetCore.Authorization;
  using Microsoft.AspNetCore.Mvc.Controllers;
  using Microsoft.AspNetCore.Mvc.Filters;
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Reflection;
  using System.Threading.Tasks;
  
  namespace Gamma.Core.Security
  {
      public abstract class AttributeAuthorizationHandler&lt;TRequirement,     TAttribute&gt;
      : AuthorizationHandler&lt;TRequirement&gt; where TRequirement
      : IAuthorizationRequirement where TAttribute : Attribute
      {
          Microsoft.AspNetCore.Http.IHttpContextAccessor _httpContextAccessor = null;
          public AttributeAuthorizationHandler(Microsoft.AspNetCore.Http.IHttpContextAccessor httpContextAccessor)
          {
              _httpContextAccessor = httpContextAccessor;
          }
          protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, TRequirement requirement)
          {
              var attributes = new List&lt;TAttribute&gt;();
  
              var action = (context.Resource as AuthorizationFilterContext)?.ActionDescriptor as ControllerActionDescriptor;
              if (context.Resource is Microsoft.AspNetCore.Http.Endpoint endpoint)
              {
                  //endpoint.
              }
  
              if (action != null)
              {
                  attributes.AddRange(GetAttributes(action.MethodInfo));
              }
  
              return HandleRequirementAsync(context, requirement, attributes);
          }
  
          protected abstract Task HandleRequirementAsync(AuthorizationHandlerContext context, TRequirement requirement, IEnumerable&lt;TAttribute&gt; attributes);
  
          private static IEnumerable&lt;TAttribute&gt; GetAttributes(MemberInfo memberInfo)
          {
              return memberInfo.GetCustomAttributes(typeof(TAttribute), false).Cast&lt;TAttribute&gt;();
          }
      }
  }
  </code></pre>