Open Closed

How to authenticate against separate database? #2653


User avatar
0
TonyH created

I've previously used ASP.NET Zero, where I could modify the authentication code so that the username / password combination was passed to my own external service, which would then authenticate the user against a standalone database used for a separate application.

When the response was returned, ASP.NET Zero was automatically creating the user in it's own database as well.

Is there a way to achieve something similar in ABP.io? Basically, I need to take the username / password that the user enters, and pass those, along with a custom key stored against the tenant, to an external service. That service will return a boolean indicating whether the username / password was a valid combination, along with a key/value list that will need to be stored against the ICurrentUser ... I'm guessing as Claims?

Any help / examples would be appreciated!

T

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

7 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Is it this?

    https://github.com/abpframework/abp/issues/4977

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    TonyH created

    Indeed, that could be the core of the solution! I will try it in the next day or so, and see if it meets the requirements.

    I'm not sure how/where I could create new user Claims in this scenario, though.

    Is that something that would happen in GetUserInfoAsync?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    https://docs.abp.io/en/abp/latest/Authorization#claims-principal-factory

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    TonyH created

    Okay, partway there with this. I'm just stuck on where to put this code:

    Configure<AbpIdentityAspNetCoreOptions>(options => { options.ExternalLoginProviders.Add<FakeExternalLoginProvider>(FakeExternalLoginProvider.Name); });

    I'm on current build, Blazor, minimal .NET 6.

    I thought it might have to go into the module class, in the "ConfigureExternalProviders" method ... but I can't seem to get the syntax correct.

    Can you please assist?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    This does't support the balzor wasm. You should configure it on the API website.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    TonyH created

    Great, thanks.

    Read a little further down, and someone had corrected the registration code so that it used "AbpIdentityOptions", rather than "AbpIdentityAspNetCoreOptions":

    Configure<AbpIdentityOptions>(options => { options.ExternalLoginProviders.Add<FakeExternalLoginProvider>(FakeExternalLoginProvider.Name); });

    Actually got it working in the Blazor app ... I'm building for server-side Blazor, not WASM. That said, yes, it probably needs implementing in the API project as well.

    That's half the problem solved ... now to tackle the Claims component ... :-)

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    https://docs.abp.io/en/abp/latest/Authorization#claims-principal-factory

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.