File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ namespace Admin.Core.Attributes
1616 [ AttributeUsage ( AttributeTargets . Class | AttributeTargets . Method , AllowMultiple = true ) ]
1717 public class PermissionAttribute : AuthorizeAttribute , IAuthorizationFilter , IAsyncAuthorizationFilter
1818 {
19- public async void OnAuthorization ( AuthorizationFilterContext context )
19+ private async Task PermissionAuthorization ( AuthorizationFilterContext context )
2020 {
2121 //排除匿名访问
2222 if ( context . ActionDescriptor . EndpointMetadata . Any ( m => m . GetType ( ) == typeof ( AllowAnonymousAttribute ) ) )
@@ -45,10 +45,14 @@ public async void OnAuthorization(AuthorizationFilterContext context)
4545 }
4646 }
4747
48- public Task OnAuthorizationAsync ( AuthorizationFilterContext context )
48+ public async void OnAuthorization ( AuthorizationFilterContext context )
49+ {
50+ await PermissionAuthorization ( context ) ;
51+ }
52+
53+ public async Task OnAuthorizationAsync ( AuthorizationFilterContext context )
4954 {
50- OnAuthorization ( context ) ;
51- return Task . CompletedTask ;
55+ await PermissionAuthorization ( context ) ;
5256 }
5357 }
5458}
You can’t perform that action at this time.
0 commit comments