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
7 Answer(s)
-
0
hi
Is it this?
https://github.com/abpframework/abp/issues/4977
-
0
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?
-
0
hi
https://docs.abp.io/en/abp/latest/Authorization#claims-principal-factory
-
0
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?
-
0
This does't support the balzor wasm. You should configure it on the API website.
-
0
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 ... :-)
-
0
hi
https://docs.abp.io/en/abp/latest/Authorization#claims-principal-factory