jjzjj

ApplicationUserManager

全部标签

c# - AspIdentiy ApplicationUserManager 是静态的,如何扩展以使其参与我的 IoC 框架?

在新的ASPNETMVC应用程序中,您现在可以免费获得AspIdentity好东西。有一条无害的小线路“在此处插入您的电子邮件服务”。所以我做了:publicclassEmailService:IIdentityMessageService{privatestaticMy.Services.IEmailService_emailservice;publicEmailService(Insolvency.Services.IEmailServiceemailservice){_emailservice=emailservice;}publicTaskSendAsync(IdentityM

c# - 使用来自桌面应用程序的 MVC 身份代码

我正在尝试使用来自桌面应用程序的MVC身份代码。桌面应用程序需要对我的用户数据进行大量添加和更新。我已经从生成的MVC应用程序中复制了这些类,安装了所需的包并进行了代码编译所需的所有更改。我现在唯一的问题是创建ApplicationUserManager类的实例。publicApplicationUserManagerUserManager{get=>_userManager??HttpContext.Current.GetOwinContext().GetUserManager();privateset{_userManager=value;}}privateApplicationU

c# - ApplicationUserManager.Create 在每个请求上调用

我正在使用asp.netmvc5与外部供应商owin提供(facebook,twitter)ApplicationUserManager.Create在每次请求时被调用。那里有很多登录用户不必要的东西(密码验证器配置或短信和电子邮件服务配置....)varmanager=newApplicationUserManager(newUserStore(context.Get()));//Configurevalidationlogicforusernamesmanager.UserValidator=newUserValidator(manager){AllowOnlyAlphanumer

c# - System.Web.Http.ApiController.get_Request() 中缺少方法

我有一个Controller。publicsealedclassAccountsController:BaseApiController{privatereadonlyIDatabaseAdapter_databaseAdapter;publicAccountsController(IDatabaseAdapterdatabaseAdapter){_databaseAdapter=databaseAdapter;}[AllowAnonymous][Route("create")]publicasyncTaskCreateUser(CreateUserBindingModelcreate

c# - WebApi + 简单注入(inject)器 + OWIN

我正在尝试在WebAPI项目中将SimpleInjector与OWIN结合使用。但是,ConfigureAuth中的以下行失败app.CreatePerOwinContext(container.GetInstance);异常(exception)情况是ApplicationUserManager注册为“WebAPI请求”生活方式,但该实例是在WebAPI请求的上下文之外请求的。我正在使用container.RegisterWebApiRequest();在容器初始化中。(如果我使用Register而不是RegisterWebApiRequest不会有任何异常(exception),但

c# - 如何在 DI 中注册自定义 UserStore 和 UserManager

这是我的设置:publicclassApplicationUser:IdentityUser{}publicclassApplicationRole:IdentityRole{}publicclassApplicationUserLogin:IdentityUserLogin{}publicclassApplicationUserClaim:IdentityUserClaim{}publicclassApplicationRoleClaim:IdentityRoleClaim{}这是我的UserStore的定义publicclassApplicationUserStore:UserSt

c# - 使用 Ninject OWIN 中间件在 OWIN 启动中依赖注入(inject) UserStore

在使用OWIN请求管道创建ApplicationUserManager时,我在使用依赖注入(inject)创建自定义UserStore时遇到问题。背景我正在尝试将Web应用程序中的用户功能从使用SimpleMembership迁移到新的ASP.NETIdentity。当开始一个新的MVC5项目时,单页应用程序的默认实现使用ASP.Identity,使用EntityFramework来实现UserStore功能。在我的例子中,我们已经使用NHibernate作为ORM,并使用ninject来实现工作单元模式,这样我们每个请求都有一个NHibernatesession,我想让ASP.Ide

c# - 使用 Ninject OWIN 中间件在 OWIN 启动中依赖注入(inject) UserStore

在使用OWIN请求管道创建ApplicationUserManager时,我在使用依赖注入(inject)创建自定义UserStore时遇到问题。背景我正在尝试将Web应用程序中的用户功能从使用SimpleMembership迁移到新的ASP.NETIdentity。当开始一个新的MVC5项目时,单页应用程序的默认实现使用ASP.Identity,使用EntityFramework来实现UserStore功能。在我的例子中,我们已经使用NHibernate作为ORM,并使用ninject来实现工作单元模式,这样我们每个请求都有一个NHibernatesession,我想让ASP.Ide

c# - 无法从 apicontroller 中的 OwinContext 获取 UserManager

我正在按照Microsoft示例使用Identity2.0.0实现电子邮件验证我卡在这部分了publicApplicationUserManagerUserManager{get{return_userManager??HttpContext.GetOwinContext().GetUserManager();}privateset{_userManager=value;}}这在controller中有效,但HttpContext在ApiController中不包含任何GetOwinContext方法。所以我尝试了HttpContext.Current.GetOwinContext()

c# - 无法从 apicontroller 中的 OwinContext 获取 UserManager

我正在按照Microsoft示例使用Identity2.0.0实现电子邮件验证我卡在这部分了publicApplicationUserManagerUserManager{get{return_userManager??HttpContext.GetOwinContext().GetUserManager();}privateset{_userManager=value;}}这在controller中有效,但HttpContext在ApiController中不包含任何GetOwinContext方法。所以我尝试了HttpContext.Current.GetOwinContext()