Make AbpMvcAuthorizeFilter and AbpApiAuthorizeFilter overridable
See original GitHub issueIn the previous version,There is not AbpMvcAuthorizeFilter
,
There is only AbpMvcAuthorizeAttribute
. And I override this and override OnAuthorization
to redirect a different page when Unauthorized.
but in lastest version.I find that there is AbpMvcAuthorizeFilter
and AbpMvcAuthorizeAttribute
.
in the AbpMvcAuthorizeFilter
, _authorizationHelper.Authorize(methodInfo);
has be called.
how to override AbpMvcAuthorizeFilter or AbpMvcAuthorizeAttribute to redirect a different page when Unauthorized?
Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Comments:17 (16 by maintainers)
Top Results From Across the Web
Overriding controller AuthorizeAttribute for just one action
My question is once I've added [Authorize] at the controller level can I override it (or remove it) with [CustomAuthorize] on just one...
Read more >AuthorizeFilter Class (Microsoft.AspNetCore.Mvc. ...
An implementation of IAsyncAuthorizationFilter which applies a specific AuthorizationPolicy. MVC recognizes the AuthorizeAttribute and adds an instance of ...
Read more >Setting global authorization policies using the ...
The first option is to apply an AuthorizeFilter globally to all your MVC actions and Razor Pages. This is the approach traditionally used...
Read more >Simple authorization in ASP.NET Core
Learn how to use the Authorize attribute to restrict access to ASP.NET Core controllers and actions.
Read more >Custom policy evaluator to enforce multiple authentication ...
Create my own AuthorizeFilter s and override which evaluator they use (which would then allow me to have multiple simpler IPolicyEvaluator ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Set a lower order:
@jamesatgithub I ran into the same issue, though totally unrelated to this project. Try
GlobalFilters.Filters.Remove(GlobalFilters.Filters.Single(f => f.Instance is AbpMvcAuthorizeFilter).Instance);
.When I passed in the
Instance
to the Remove function it worked, it makes sense because you pass the instance to theAdd
function, so we should pass it to theRemove
function as well. It’s unfortunate MSFT doesn’t provide more details/documentation on the Remove method.