Exemplo n.º 1
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            // DBContext
            services.AddDatabaseSetup(Configuration);

            // DI
            DI.RegisterServices(services);

            // AutoMapper
            services.AddAutoMapper(typeof(MappingProfile));

            // CORS
            services.AddCors(options =>
            {
                options.AddPolicy("CorsPolicy",
                                  builder => builder.AllowAnyOrigin()
                                  .AllowAnyMethod()
                                  .AllowAnyHeader());
            });

            // JWT
            JWTSetup.AddJWTSetup(services, Configuration);
        }
Exemplo n.º 2
0
 public AuthController(
     ApplicationDbContext db,
     UserManager <ApplicationUser> userManager,
     SignInManager <ApplicationUser> signInManager,
     IOptions <JWTSetup> jwtSetup
     ) : base(db)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _jwtSetup      = jwtSetup.Value;
 }
Exemplo n.º 3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            SwaggerSetup.ConfigureServices(services);

            CorsSetup.ConfigureServices(services);

            EntityFrameWorkSetup.ConfigurationServices(services, Configuration);

            DependencyInjectionSetup.ConfigureServices(services);

            JWTSetup.ConfigureServices(services, Configuration);

            AutoMapperSetup.ConfigureServices(services);
        }