// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(options => { options.AddPolicy("AllowAll", builder => { builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader(); }); }); services.AddControllers(); Configdependecyinjection.Setup(services, Configuration); DataDiConfig.Setup(services, Configuration); ConfigureDi.Setup(services); services.AddAutoMapper(typeof(AutoMapperProfile)); //Auth JwtAuthConfig.Setup(services, Configuration); //services.AddDirectoryBrowser(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } app.UseDefaultFiles(); app.UseStaticFiles(); app.UseWebSockets(); app.UseHttpsRedirection(); app.UseMvc(); // JWT JwtAuthConfig.AddRegistration(app, this._configuration); // Cors CorsConfig.AddRegistration(app); //GraphQL GraphQLConfig.AddRegistration(app); }
public LoginModel(IJwtProvider jwtProvider, IOptions <JwtAuthConfig> jwtAuthConfig, ICacheProvider _cacheService, IUserService _userService, IEventPublisher _eventPublisher) { this._jwtProvider = jwtProvider; this._jwtAuthConfig = jwtAuthConfig.Value; this._cacheService = _cacheService; this._userService = _userService; this._eventPublisher = _eventPublisher; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); // Inject Dependecies IoCRegister.AddRegistration(services); // JWT JwtAuthConfig.AddRegistration(services, this._configuration); // Cors CorsConfig.AddRegistration(services); //GraphQL GraphQLConfig.AddRegistration(services); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); // Swagger SwaggerConfig.AddRegistration(services); // AutoMapper AutoMapperConfig.AddRegistration(services); // Inject Dependecies IoCRegister.AddRegistration(services); // JWT JwtAuthConfig.AddRegistration(services, _configuration); // Cors CorsConfig.AddRegistration(services); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(o => o.AddPolicy("LoginCors", builder => { builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader(); })); services.AddControllers(); JwtAuthConfig.Setup(services, Configuration); var mapperConfig = new MapperConfiguration(t => { t.AddProfile(new AutoMapperProfile()); }); IMapper mapper = mapperConfig.CreateMapper(); services.AddSingleton(mapper); services.UserShopService(); services.AddDbContext <ShopDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"), b => b.MigrationsAssembly("Domain"))); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(o => o.AddPolicy("TestCors", builder => { builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader(); })); services.AddControllers(); Configdependecyinjection.Setup(services, Configuration); DataDiConfig.Setup(services, Configuration); ConfigureDi.Setup(services); //Auth JwtAuthConfig.Setup(services, Configuration); //services.AddDirectoryBrowser(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } // Swagger SwaggerConfig.AddRegistration(app); // JWT JwtAuthConfig.AddRegistration(app, this._configuration); // Cors CorsConfig.AddRegistration(app); app.UseHttpsRedirection(); app.UseAuthentication(); app.UseHttpsRedirection(); app.UseMvc(); }
public static void AddJwtAuth(this IServiceCollection services, JwtAuthConfig configuration) { JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear(); services .AddAuthentication(options => { options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }) .AddJwtBearer(cfg => { cfg.RequireHttpsMetadata = false; cfg.SaveToken = true; cfg.TokenValidationParameters = new TokenValidationParameters { ValidIssuer = configuration.Issuer, ValidAudience = configuration.Issuer, IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(configuration.Key)), ClockSkew = TimeSpan.Zero, }; }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); services.UserGiantStoreServices(); JwtAuthConfig.Setup(services, Configuration); }
public IdentityLoginService(SignInManager <IdentityUser> signInManager, UserManager <IdentityUser> userManager, IOptionsMonitor <JwtAuthConfig> configuration) { _signInManager = signInManager; _userManager = userManager; _configuration = configuration.CurrentValue; }
public TokenRepository(IOptions <JwtAuthConfig> jwtAuthConfig, TokenDbContext context) { _jwtAuthConfig = jwtAuthConfig.Value; _context = context; }
protected void Application_Start() { UnityConfig.RegisterComponents(); JwtAuthConfig.Configure(ConfigurationManager.AppSettings); GlobalConfiguration.Configure(WebApiConfig.Register); }