コード例 #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            StartupIoc.ConfigureServices(services, Configuration);

            var key = Encoding.ASCII.GetBytes(Settings.Secret);

            services.AddAuthentication(x =>
            {
                x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                x.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
            })
            .AddJwtBearer(x =>
            {
                x.RequireHttpsMetadata      = false;
                x.SaveToken                 = true;
                x.TokenValidationParameters = new TokenValidationParameters
                {
                    ValidateIssuerSigningKey = true,
                    IssuerSigningKey         = new SymmetricSecurityKey(key),
                    ValidateIssuer           = false,
                    ValidateAudience         = false
                };
            });


            services.AddCors(options =>
            {
                options.AddPolicy(name: AllowSpecificOrigins,
                                  builder =>
                {
                    builder.AllowAnyOrigin();
                    builder.AllowAnyHeader();
                    builder.AllowAnyMethod();
                });
            });

            services.AddControllers();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            //if you want to include in the data base
            var builder = new ConfigurationBuilder().SetBasePath(GetBasePath())
                          .AddJsonFile("appsettings.json", optional: false);

            IConfiguration configuration     = builder.Build();
            var            serviceCollection = new ServiceCollection();

            //setup our DI
            StartupIoc.ConfigureServices(serviceCollection, configuration);

            //do the actual work here
            var boardService = serviceCollection.BuildServiceProvider().GetService <IBoardRepository>();
            var addService   = serviceCollection.BuildServiceProvider().GetService <AddBoard>();

            //the game without connection with database
            var game = Game.Models.Game.CreateNewGame();

            game.Start();

            Thread.Sleep(60000);
            System.Console.ReadKey();
        }
コード例 #3
0
ファイル: Startup.cs プロジェクト: moraisbrian/TDD_xUnit
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            StartupIoc.ConfigureServices(services, Configuration["ConnectionString"]);

            services.AddControllers();
        }
コード例 #4
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     StartupIoc.ConfigureServices(services, Configuration);
     services.AddControllersWithViews();
 }
コード例 #5
0
ファイル: Startup.cs プロジェクト: vitorvaf/PlataformaCursos
 // 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.AddMvc();
     StartupIoc.ConfigureService(services, Configuration);
 }