Base solution for your next web application
Open Closed

changing the authentication provider #3121


User avatar
0
malomatia created

I need to know how to change the authentication provider (users store) from SQL Server to custom Web Service, i tried to follow the code and reached to the method GetLoginResultAsync under TokenAuthController which calls _logInManager.LoginAsync which leads to AbpLogInManager class , however couldn't follow to AbpLogInManager class as it's referenced as DLL only.

can you please provide bullet points to change the authentication provider ? including get current session method which checks the user in the SQL database as well.

Best, Ahmed


6 Answer(s)
  • User Avatar
    0
    tteoh created

    Hi Ahmed,

    The DLL source codes can be found at GitHub. It's either part of aspboilerplate or module-zero.

    Good luck.

    Regards, /tommy

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Thanks @tteoh for your answer. Yes, AbpLoginManager is in Abp.Zero package. You can check it here <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero/blob/master/src/Abp.Zero/Authorization/AbpLoginManager.cs">https://github.com/aspnetboilerplate/mo ... Manager.cs</a>.

    In AspNetZero, there is a class named LogInManager which derives from AbpLoginManager. You can override any method in it includin LoginAsync.

    Thanks.

  • User Avatar
    0
    malomatia created

    Thank you very much, Now if i change this method to login via web service, What about GetCurrentSession ? is it in the same DLL ? and is there a way to implement it the same way as the active directory authentication ?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    When you mentioned that i realized you can also use an external auth explained in here <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Zero/User-Management#external-authentication">https://aspnetboilerplate.com/Pages/Doc ... entication</a>.

    Why didn't you choose that way ?

  • User Avatar
    0
    malomatia created

    this is exactly what i was looking for, Thank you.

    one last question, what about get current user session, i don't remember the exact name but i remember there is something like that to check the current user session

    in other words will the external authentication work fine if the users store is totally external and no users saved in the SQL DB ?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I think you will need a user record in local SQL anyway. For example, LDAP auth creates and updates user info when a user logs in with LDAP. In some places of AspNet Zero, we query AbpUsers table directly with a repository.

    So, you can follow a similar approach like LDAP auth.