// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { Initializer.Configure(services, Configuration["ConnectionStrings:DefaultConnection"]); services.AddControllers(); services.AddHttpClient(); services.AddSwaggerGen(); services.AddSingleton <IConfiguration>(Configuration); //AutenticaĆ§Ć£o JWT services.AddAuthentication (JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(options => { options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuer = true, ValidateAudience = true, ValidateLifetime = true, ValidateIssuerSigningKey = true, ValidIssuer = Configuration["Jwt:Issuer"], ValidAudience = Configuration["Jwt:Audience"], IssuerSigningKey = new SymmetricSecurityKey (Encoding.UTF8.GetBytes(Configuration["Jwt:Key"])) }; }); }
public void ConfigureServices(IServiceCollection services) { Initializer.Configure(services, Configuration.GetConnectionString("Default")); services.AddControllers(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "Contatos.Web", Version = "v1" }); }); }
public void ConfigureServices(IServiceCollection services) { Initializer.Configure(services, Configuration.GetConnectionString("DefaultConnection")); services.AddControllers(); }