Esempio n. 1
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddAuthentication(TestServerDefaults.AuthenticationScheme)
            .AddTestServer(options =>
            {
                options.Events = new TestServerEvents
                {
                    OnMessageReceived      = context => Task.CompletedTask,
                    OnTokenValidated       = context => Task.CompletedTask,
                    OnAuthenticationFailed = context => Task.CompletedTask,
                    OnChallenge            = context => Task.CompletedTask
                };
            })
            .AddTestServer("Bearer", options =>
            {
                options.NameClaimType = "name";
                options.RoleClaimType = "role";
                options.Events        = new TestServerEvents
                {
                    OnMessageReceived      = context => Task.CompletedTask,
                    OnTokenValidated       = context => Task.CompletedTask,
                    OnAuthenticationFailed = context => Task.CompletedTask,
                    OnChallenge            = context => Task.CompletedTask
                };
            });

            var mvcCoreBuilder = services.AddMvcCore()
                                 .SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
                                 .AddApplicationPart(Assembly.Load(new AssemblyName("Sample.Api")));

            ApiConfiguration.ConfigureCoreMvc(mvcCoreBuilder);
        }
Esempio n. 2
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
            .AddJwtBearer();

            var mvcCoreBuilder = services.AddMvcCore();

            ApiConfiguration.ConfigureCoreMvc(mvcCoreBuilder);
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddAuthentication(options =>
            {
                options.DefaultScheme = TestServerAuthenticationDefaults.AuthenticationScheme;
            })
            .AddTestServerAuthentication();

            var mvcCoreBuilder = services.AddMvcCore();

            ApiConfiguration.ConfigureCoreMvc(mvcCoreBuilder);
        }
Esempio n. 4
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddAuthentication(TestServerAuthenticationDefaults.AuthenticationScheme)
            .AddTestServerAuthentication()
            .AddTestServerAuthentication("Bearer", options =>
            {
                options.NameClaimType = "name";
                options.RoleClaimType = "role";
            });

            var mvcCoreBuilder = services.AddMvcCore();

            ApiConfiguration.ConfigureCoreMvc(mvcCoreBuilder);
        }