Exemplo n.º 1
0
        static ApplicationDbContext CreateManagers(out WebApiUserManager userManager, out ApplicationRoleManager roleManager)
        {
            var context   = ApplicationDbContext.Create();
            var userStore = new ApplicationUserStore(context, App.Id);
            var roleStore = new ApplicationRoleStore(context, App.Id);

            userManager = new WebApiUserManager(userStore);
            roleManager = new ApplicationRoleManager(roleStore);

            return(context);
        }
Exemplo n.º 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors();

            services.AddMvc();

            services.AddDbContext <NORTHWNDContext>(options => options.UseSqlServer(HelperAppSettings.ConnectionString, b => b.MigrationsAssembly("WebApi.Core")));

            services.AddIdentity <User, Roles>(Options => WebApiUserManager.CreateOptions(Options))
            .AddEntityFrameworkStores <NORTHWNDContext>();

            RegisterIoC(services);

            //services.Configure<AppSettings>(Configuration);
        }
Exemplo n.º 3
0
 static WebApiUserManager CreateUserManagerOwin(IdentityFactoryOptions <WebApiUserManager> options, IOwinContext context)
 {
     return(WebApiUserManager.Create(options, context, App.Id));
 }
Exemplo n.º 4
0
        public FakeIdentity(WebApiUserManager userManager, IUnitOfWork unitOfWork)
        {
            _userManager = userManager;

            _unitOfWork = unitOfWork;
        }
Exemplo n.º 5
0
 public ClientService(IUnitOfWork unitOfWork, WebApiUserManager userManager) : base(unitOfWork)
 {
     _userManager = userManager;
 }