Base solution for your next web application
Open Closed

External authentication method #8773


User avatar
0
logicpulse created

Hi,

Can anyone give me some more detailed explanation about this matter: external-authentication In concrete, the example they gave... I dont understand and I dont know where to find it.

I need it to use in my application.

Thanks in advance.


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

    Hi @logicpulse,

    Could you explain how would you liek to use it ?

  • User Avatar
    0
    logicpulse created

    Hi,

    Sure. I have another application that it's working with a login... and I need that users login match with my current application developed in ASP.NET Core/Angular logins. In other words, I have a table named "Users" with different logins from that old application (and I think I need to create it in my application .NET Core/Angular) and I have the table "AbpUsers" in the application .NET Core/Angular... the logins must match, so that I can login/register users from the old application in the new one.

    Please tell me if you understand what I'm trying to say.

    Thanks.

  • User Avatar
    0
    maliming created
    Support Team

    hi @logicpulse

    This DefaultExternalAuthenticationSource source code. https://github.com/aspnetboilerplate/aspnetboilerplate/blob/e0ded5d8702f389aa1f5947d3446f16aec845287/src/Abp.Zero.Common/Authorization/Users/DefaultExternalAuthenticationSource.cs#L12

    You can read the Users table of another application in the TryAuthenticateAsync method to verify the user password and return true or false.

    Of course, you can also call the remote api in the method to authenticate the user.

    If the method returns true. AbpLoginManager will create the user. You can check the source code to understand how it works.

    https://github.com/aspnetboilerplate/aspnetboilerplate/blob/c0604b9b1347a3b9581bf97b4cae22db5b6bab1b/src/Abp.ZeroCore/Authorization/AbpLoginManager.cs#L324

  • User Avatar
    0
    logicpulse created

    Hello all,

    Thanks for the help. I'm sorry to bother you again... but where do I put that files like DefaultExternalAuthenticationSource and IExternalAuthenticationSource.cs in my application? I mean, in what module (or folder) do I put it?

    Here goes a screenshot... of the places that can be put in. In logicpulseDemo.Application or logicpulseDemo.Application.Shared or another one?

  • User Avatar
    0
    maliming created
    Support Team

    hi

    Since it is authentication, it should appear in Web.Core

  • User Avatar
    0
    logicpulse created

    Hello,

    Thanks. Now I have just one more problem. You (maliming) said this "You can read the Users table of another application in the TryAuthenticateAsync method to verify the user password and return true or false." My problem is, how can I read the Users table of another application? I mean, how can I read a table (instead of create it) from another Database? Can you give me some example please?

  • User Avatar
    0
    maliming created
    Support Team

    how can I read a table from another Database?

    You can use EF Core or Dapper or ado.net to connect to the database and read the contents of the table.

  • User Avatar
    1
    logicpulse created

    Problem solved. Thank you for all the support.