Base solution for your next web application
Open Closed

Extend AbpAuthorize attribute #5108


User avatar
0
dreamsmiths created

Good day,

Is there a way in boilerplate to extend the AbpAuthorize attribute ?

I want to achieve the following:

When an authorized application service function is called , I want to execute some logic without adding a custom attribute to each authorized application service.

Thanks in advance.


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can create a new class deriving from <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp/Authorization/AuthorizationHelper.cs">https://github.com/aspnetboilerplate/as ... nHelper.cs</a>. Then you can override the methods you want and execute your logic.

    You also need to replace IAuthorizationHelper interface's implementation with your custom one like below in the PreInitialize method of your core module;

    Configuration.ReplaceService<IAuthorizationHelper, MyAuthorizationHelper >(DependencyLifeStyle.Transient);
    
  • User Avatar
    0
    dreamsmiths created

    Hi,

    Thanks in a million. Works like a bom!