Hi, I've create the code to implement an External Authentication module. What I don't realize is how to call from a client this different authentication system. I need to use both ways: the default abpTables and this new one. I've tried to call by "api/TokenAuth/ExternalAuthenticate/" but I receive the error: Unknown external auth provider: MyAuth
public class MyAuthExternalAuthenticationSource: DefaultExternalAuthenticationSource<Tenant,User>, ITransientDependency
{
public override Task<bool> TryAuthenticateAsync(string userNameOrEmailAddress, string plainPassword, Tenant tenant)
{
return Task.FromResult(true);
}
public override string Name => "MyAuth";
}
}
public override void PreInitialize()
{
Configuration.Modules.Zero().UserManagement.ExternalAuthenticationSources.Add<MyAuthExternalAuthenticationSource>();
}
What I'm missing? Thanks
4 Answer(s)
-
0
Are you registering it in the core module?
-
0
No, my custom authentication is developed as Modules Plugins loaded by options.PlugInSources.AddFolder(@"C:\MyPlugIns"); All code involved is what I have posted I have to register the external authentication elsewhere?
-
0
hi,
I guess you'r confusing ExternalAuthentication with Social Authentication. Let me explain what ExternalAuthentication does. When you register your ExternalAuthentication you say ABP that you handle credential verification. So you ignore validating credentials against database. The most common use case of ExternalAuthentication is LDAP login. User enters username and password to the login page. It comes to your ExternalAuthentication implementation. You return true if you validate user. The user is being persisted to the database.
If you want social authentication, AspNet Zero is pre-configured to work with Facebook, Google, Twitter and Microsoft login. You just need to set some credentials due to your provider. Click here to find out how to do that
If you want to connect to a new social platform which is compatible with OAuth 2.0, click here to get further information
-
0
Thank you for clarification. So, what I need is ExternalAutentication for some users, and default authentication for other. I noted if I return true for every existing user that try to login, the field AuthenticationSource is populate with my external authentication name. So i would like to limit to one specific authentication source per user.
How can I achive this?
Thanks