private async Task CreateManager(OwinContext context)
 {
     var options = new IdentityFactoryOptions <ApplicationUserManager>
     {
         DataProtectionProvider = new DpapiDataProtectionProvider(),
         Provider = new IdentityFactoryProvider <ApplicationUserManager>
         {
             OnCreate = (o, c) => ApplicationUserManager.Create(o, c)
         }
     };
     var middleware =
         new IdentityFactoryMiddleware <ApplicationUserManager, IdentityFactoryOptions <ApplicationUserManager> >(
             null, options);
     var dbMiddle =
         new IdentityFactoryMiddleware <ApplicationDbContext, IdentityFactoryOptions <ApplicationDbContext> >(
             middleware,
             new IdentityFactoryOptions <ApplicationDbContext>
     {
         Provider = new IdentityFactoryProvider <ApplicationDbContext>
         {
             OnCreate = (o, c) => CreateDb()
         }
     });
     await dbMiddle.Invoke(context);
 }
示例#2
0
 private async Task CreateManager(OwinContext context)
 {
     var options = new IdentityFactoryOptions <UserManager <IdentityUser> >
     {
         Provider = new TestProvider(),
         DataProtectionProvider = new DpapiDataProtectionProvider()
     };
     var middleware =
         new IdentityFactoryMiddleware
         <UserManager <IdentityUser>, IdentityFactoryOptions <UserManager <IdentityUser> > >(null, options);
     await middleware.Invoke(context);
 }
示例#3
0
 public static async Task CreateManager(OwinContext context)
 {
     var options = new IdentityFactoryOptions <UserManager <IdentityUser> >
     {
         Provider = new TestProvider(UnitTestHelper.CreateDefaultDb()),
         DataProtectionProvider = new DpapiDataProtectionProvider()
     };
     var middleware =
         new IdentityFactoryMiddleware
         <UserManager <IdentityUser>, IdentityFactoryOptions <UserManager <IdentityUser> > >(null, options);
     await middleware.Invoke(context);
 }
示例#4
0
        public async Task SetUp()
        {
            mMembershipFakeFactory.GetIntegrationUsers().ToList().ForEach(x => UserInfoProvider.SetUserInfo(x));
            mMembershipFakeFactory.GetIntegrationRoles().ToList().ForEach(x => RoleInfoProvider.SetRoleInfo(x));
            mMembershipFakeFactory.GetIntegrationExternalLogins().ToList().ForEach(x => ExternalLoginInfoProvider.SetExternalLoginInfo(x));
            SettingsKeyInfoProvider.SetValue("cmssitesharedaccounts", 0, "True");

            mOwinContext = new OwinContext();
            var options = new IdentityFactoryOptions <UserManager>
            {
                Provider = new TestIdentityFactoryProvider(),
                DataProtectionProvider = new DpapiDataProtectionProvider()
            };
            var middleware = new IdentityFactoryMiddleware <UserManager, IdentityFactoryOptions <UserManager> >(null, options);
            await middleware.Invoke(mOwinContext);

            var manager = mOwinContext.GetUserManager <UserManager>();

            mSignInManager = new SignInManager(mOwinContext.GetUserManager <UserManager>(), mOwinContext.Authentication);
        }
 private async Task CreateManager(OwinContext context)
 {
     var options = new IdentityFactoryOptions <UserManager <GuidUser, Guid> >
     {
         Provider = new TestProvider(),
         DataProtectionProvider = new DpapiDataProtectionProvider()
     };
     var middleware =
         new IdentityFactoryMiddleware
         <UserManager <GuidUser, Guid>, IdentityFactoryOptions <UserManager <GuidUser, Guid> > >(null, options);
     var dbMiddle = new IdentityFactoryMiddleware <DbContext, IdentityFactoryOptions <DbContext> >(middleware,
                                                                                                   new IdentityFactoryOptions <DbContext>
     {
         Provider = new IdentityFactoryProvider <DbContext>
         {
             OnCreate = (o, c) => GuidUserContext.Create(),
         }
     });
     await dbMiddle.Invoke(context);
 }