// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddIdentityWithMongoStoresUsingCustomTypes <Usuario, UsuarioRole>(Configuration.GetSection("MongoConnectionStrings:ConnectionStringFull").Value) .AddDefaultTokenProviders(); services.AddAuthorization(opt => PolicyConfig.Configurar(opt)); AuthenticationConfig.Configurar(services, Configuration); NativeInjection.RegisterDependencys(services); services.AddOptions(); services.AddMvc(opt => { var policy = new AuthorizationPolicyBuilder() .AddAuthenticationSchemes(JwtBearerDefaults.AuthenticationScheme) .RequireAuthenticatedUser() .Build(); opt.Filters.Add(new AuthorizeFilter(policy)); }); services.AddSwaggerGen(s => { s.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info { Title = "Delivery API", Version = "v1" }); }); }