Beispiel #1
0
        public async Task GetTokenWorksWithExplicitScheme()
        {
            var context  = new DefaultProtoContext();
            var services = new ServiceCollection().AddOptions()
                           .AddAuthenticationCore(o => o.AddScheme("simple", s => s.HandlerType = typeof(SimpleAuth)));

            context.RequestServices = services.BuildServiceProvider();

            Assert.Equal("1", await context.GetTokenAsync("simple", "One"));
            Assert.Equal("2", await context.GetTokenAsync("simple", "Two"));
            Assert.Equal("3", await context.GetTokenAsync("simple", "Three"));
        }