private static void RegisterServices(IServiceCollection services) { var signingKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(secretKey)); var tokenValidationParameters = new TokenValidationParameters { // The signing key must match! ValidateIssuerSigningKey = true, IssuerSigningKey = signingKey, // Validate the JWT Issuer (iss) claim ValidateIssuer = true, ValidIssuer = "Issuer", // Validate the JWT Audience (aud) claim ValidateAudience = true, ValidAudience = "Audience", // Validate the token expiry ValidateLifetime = true, // If you want to allow a certain amount of clock drift, set that here: ClockSkew = TimeSpan.Zero }; services.AddAuthentication(options => { options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme; }) .AddJwtBearer(options => { options.TokenValidationParameters = tokenValidationParameters; options.Authority = "http://localhost:30940/"; options.Audience = "resource-server"; options.RequireHttpsMetadata = false; }); SimpleInjectorBootStrapper.RegisterServices(services); }
private static void RegisterServices(IServiceCollection services) { // Adding dependencies from another layers (isolated from Presentation) SimpleInjectorBootStrapper.RegisterServices(services); }
private void InitializeContainer() { SimpleInjectorBootStrapper.RegisterServices(container); DatabaseBootStrapper.RegisterServices(container, Configuration.GetConnectionString("dbPDV")); }
private static void RegisterServices(IServiceCollection services) { services.AddTransient <IUploadHelper, UploadHelper>(); SimpleInjectorBootStrapper.RegisterServices(services); }