File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Host/Startup Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -10,28 +10,28 @@ public class SecurityRequirementsOperationFilter : IOperationFilter
1010 {
1111 public void Apply ( Operation operation , OperationFilterContext context )
1212 {
13- var actionAttrs = context . ApiDescription . ActionAttributes ( ) ;
13+ var actionAttrs = context . ControllerActionDescriptor . MethodInfo . GetCustomAttributes ( true ) . ToList ( ) ;
1414 if ( actionAttrs . OfType < AbpAllowAnonymousAttribute > ( ) . Any ( ) )
1515 {
1616 return ;
1717 }
1818
19- var controllerAttrs = context . ApiDescription . ControllerAttributes ( ) ;
20- var actionAbpAuthorizeAttrs = actionAttrs . OfType < AbpAuthorizeAttribute > ( ) ;
19+ var controllerAttrs = context . ControllerActionDescriptor . ControllerTypeInfo . GetCustomAttributes ( true ) ;
20+ var actionAbpAuthorizeAttrs = actionAttrs . OfType < AbpAuthorizeAttribute > ( ) . ToList ( ) ;
2121
2222 if ( ! actionAbpAuthorizeAttrs . Any ( ) && controllerAttrs . OfType < AbpAllowAnonymousAttribute > ( ) . Any ( ) )
2323 {
2424 return ;
2525 }
2626
27- var controllerAbpAuthorizeAttrs = controllerAttrs . OfType < AbpAuthorizeAttribute > ( ) ;
27+ var controllerAbpAuthorizeAttrs = controllerAttrs . OfType < AbpAuthorizeAttribute > ( ) . ToList ( ) ;
2828 if ( controllerAbpAuthorizeAttrs . Any ( ) || actionAbpAuthorizeAttrs . Any ( ) )
2929 {
3030 operation . Responses . Add ( "401" , new Response { Description = "Unauthorized" } ) ;
3131
3232 var permissions = controllerAbpAuthorizeAttrs . Union ( actionAbpAuthorizeAttrs )
3333 . SelectMany ( p => p . Permissions )
34- . Distinct ( ) ;
34+ . Distinct ( ) . ToList ( ) ;
3535
3636 if ( permissions . Any ( ) )
3737 {
You can’t perform that action at this time.
0 commit comments