无法使用Ninject使用新密码登录-ASPNET身份

时间:2018-08-13 17:54:40

标签: c# authentication asp.net-web-api oauth-2.0 ninject.web.mvc

我已经在我的身份验证项目中实现了Ninject(依赖项注入)。我已经实现了基于令牌的身份验证(OAuth)。

问题:一切都按预期工作,但我每次重置密码都无法使用新密码登录。虽然它允许我仅使用旧密码登录。我已经检查了数据库,它确实包含新设置的密码的密码哈希。

以下是我在绑定NinjectConfig类中的接口时编写的代码。我认为绑定仅包含某些内容。

kernel.Bind<MasterDbContext>().ToMethod(__ => MasterDbContext.Create()).InRequestScope();
kernel.Bind<TenantDbContext>().ToMethod(_ => TenantDbContext.CreateFromTenantName(TenantName));

kernel.Bind<IOAuthAuthorizationServerOptions>().To<MyOAuthAuthorizationServerOptions>();
kernel.Bind<IOAuthAuthorizationServerProvider>().To<SimpleAuthorizationServerProvider>();

kernel.Bind<IAuthenticationTokenProvider>().To<SimpleRefreshTokenProvider>();
kernel.Bind<IMasterRepository>().To<MasterRepository>();
kernel.Bind<ITenantRepository>().To<TenantRepository>();

kernel.Bind<IAuthenticationManager>().ToMethod(c => HttpContext.Current.GetOwinContext().Authentication);
kernel.Bind<IUserStore<ApplicationUser>>().To<UserStore<ApplicationUser>>().WithConstructorArgument("context", context => kernel.Get<MasterDbContext>());
kernel.Bind<UserManager<ApplicationUser>>();

kernel.Bind<IRoleStore<IdentityRole, string>>().To<RoleStore<IdentityRole, string, IdentityUserRole>>();
kernel.Bind<RoleManager<IdentityRole>>();

任何人都可以告诉我造成此问题的原因是什么。

谢谢大家。

0 个答案:

没有答案
相关问题