public override async Task AuthenticateLocalAsync(LocalAuthenticationContext ctx)
        {
            var username = ctx.UserName;
            var password = ctx.Password;
            var message  = ctx.SignInMessage;

            ctx.AuthenticateResult = null;

            if (_userManager.SupportsUserPassword)
            {
                var user = await FindUserAsync(username);

                if (user != null)
                {
                    if (_userManager.SupportsUserLockout &&
                        await _userManager.IsLockedOutAsync(user).ConfigureAwait(false))
                    {
                        return;
                    }

                    if (await _userManager.CheckPasswordAsync(user, password))
                    {
                        if (_userManager.SupportsUserLockout)
                        {
                            await _userManager.ResetAccessFailedCountAsync(user).ConfigureAwait(false);
                        }

                        var result = await PostAuthenticateLocalAsync(user, message);

                        if (result == null)
                        {
                            var claims = await GetClaimsForAuthenticateResult(user);

                            var userId = await _userManager.GetUserIdAsync(user).ConfigureAwait(false);

                            result = new AuthenticateResult(userId, await GetDisplayNameForAccountAsync(userId), claims);
                        }

                        ctx.AuthenticateResult = result;
                    }
                    else if (_userManager.SupportsUserLockout)
                    {
                        await _userManager.AccessFailedAsync(user).ConfigureAwait(false);
                    }
                }
            }
        }