Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Thomas Enggaard Christensen 4 posts 74 karma points
    Oct 30, 2019 @ 10:15
    Thomas Enggaard Christensen
    0

    Custom password checker

    Hi

    Firstly: Umbraco version 7.13.1

    I am trying to implement a custom password checker for a site.

    I have followed this guide: https://our.umbraco.com/documentation/reference/security/custom-password-checker

    My custom password checker is being run, and it validates the password check to valid.

    However umbraco just displays an empty white screen with the url: http://localhost:61964/umbraco#/login/false?returnPath=%252Fumbraco

    If I change the password checker to invalid password, then I get the normal read error message that my credentials are invalid.

    Any idea on how to proceed from here?

  • Jeffrey Veer 31 posts 267 karma points
    Oct 30, 2019 @ 11:36
    Jeffrey Veer
    0

    Hi Thomas,

    Is there any information in the logging available? Also, do you mind sharing your code so I can test it locally as well?

  • Thomas Enggaard Christensen 4 posts 74 karma points
    Oct 30, 2019 @ 11:54
    Thomas Enggaard Christensen
    0

    the code compiles and runs. I can debug through both the WundermanPasswordChecker class and the UmbracoCustomOwinStartup class

    public class WundermanPasswordChecker : IBackOfficeUserPasswordChecker
    {
        public Task<BackOfficeUserPasswordCheckerResult> CheckPasswordAsync(BackOfficeIdentityUser user, string password)
        {
            if (password != "test")
            {
                return Task.FromResult(BackOfficeUserPasswordCheckerResult.InvalidCredentials);
            }
    
            return Task.FromResult(BackOfficeUserPasswordCheckerResult.ValidCredentials);
    
        }
    }
    
    
    
    public class UmbracoCustomOwinStartup
    {
        public void Configuration(IAppBuilder app)
        {
            ApplicationContext 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);
                    userManager.BackOfficeUserPasswordChecker = new WundermanPasswordChecker();
                    return userManager;
                }
            );
        }
    }
    
  • Thomas Enggaard Christensen 4 posts 74 karma points
    Oct 30, 2019 @ 11:55
    Thomas Enggaard Christensen
    0

    Running in a newly installed VS2017 web project installed via nuget

  • Thomas Enggaard Christensen 4 posts 74 karma points
    Oct 30, 2019 @ 15:32
    Thomas Enggaard Christensen
    0

    The log files does not show anything related to this. In fact nothing is written to the log during the login phase

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies