I am trying to use BackOfficeUserPasswordChecker to make authentication for Umbraco (with external users).
I customized the OwinStartup:
public class UmbracoCustomOwinStartup
{
public void Configuration(IAppBuilder app)
{
var applicationContext = ApplicationContext.Current;
app.ConfigureUserManagerForUmbracoBackOffice<BackOfficeUserManager, BackOfficeIdentityUser>(
applicationContext,
(options, context) =>
{
var membershipProvider = Umbraco.Core.Security.MembershipProviderExtensions.GetUsersMembershipProvider().AsUmbracoMembershipProvider();
var settingContent = Umbraco.Core.Configuration.UmbracoConfig.For.UmbracoSettings().Content;
var userManager = BackOfficeUserManager.Create(options,
applicationContext.Services.UserService,
applicationContext.Services.EntityService,
applicationContext.Services.ExternalLoginService,
membershipProvider,
settingContent);
// Set your own custom IBackOfficeUserPasswordChecker
userManager.BackOfficeUserPasswordChecker = new CustomPasswordChecker();
return userManager;
});
}
}
And I also defined CustomPasswordChecker which always return ValidCredentials in CheckPasswordAsync method:
public Task<BackOfficeUserPasswordCheckerResult> CheckPasswordAsync(BackOfficeIdentityUser user, string password)
{
return Task.FromResult(BackOfficeUserPasswordCheckerResult.ValidCredentials);
}
When I entered an user name which don't have in Umbraco database, the Umbraco login still throw the message "login failed fo user...". I debugged, and it jumped to CustomPasswordChecker.CheckPasswordAsync() correctly, but the message still throw and I can not log in successfully.
Did I missed something? And how can I make Umbraco accept external users (AD users/ users that is defined in other database,...)?
Is there the user in your Umbraco? If you tried to log in to Umbraco with User that don't have in the Umbraco then it will fall back to the default authentication.
You can try to add the user to your umbraco first.