Ejemplo n.º 1
0
        public void Initialize(string basePath = null, bool enableLogging = false)
        {
            var builder = new WebHostBuilder();

            builder.ConfigureServices(ConfigureServices);
            builder.Configure(app =>
            {
                if (basePath != null)
                {
                    app.Map(basePath, map =>
                    {
                        ConfigureApp(map);
                    });
                }
                else
                {
                    ConfigureApp(app);
                }
            });

            if (enableLogging)
            {
                //builder.ConfigureLogging((ctx, b) => b.AddConsole());
            }

            Server  = new TestServer(builder);
            Handler = Server.CreateHandler();

            BrowserClient     = new BrowserClient(new BrowserHandler(Handler));
            BackChannelClient = new HttpClient(Handler);
        }
Ejemplo n.º 2
0
        public async Task LoginAsync(ClaimsPrincipal subject)
        {
            var old = BrowserClient.AllowAutoRedirect;

            BrowserClient.AllowAutoRedirect = false;

            Subject = subject;
            await BrowserClient.GetAsync(LoginPage);

            BrowserClient.AllowAutoRedirect = old;
        }
Ejemplo n.º 3
0
 public Cookie GetAnonymousIdCookie()
 {
     return(BrowserClient.GetCookie(BaseUrl, IdentityServerConstants.DefaultCheckAnonymousIdCookieName));
 }
Ejemplo n.º 4
0
 public Cookie GetSharedSessionCookie()
 {
     return(BrowserClient.GetCookie(BaseUrl, IdentityServerConstants.DefaultCheckSharedSessionCookieName));
 }