示例#1
0
    public async Task redirect_uri_should_process_dynamic_provider_signin_result()
    {
        var response = await _host.BrowserClient.GetAsync(_host.Url("/challenge?scheme=idp1"));

        var authzUrl = response.Headers.Location.ToString();

        await _idp1.BrowserClient.GetAsync(_idp1.Url("/signin"));

        response = await _idp1.BrowserClient.GetAsync(authzUrl);

        var redirectUri = response.Headers.Location.ToString();

        redirectUri.Should().StartWith("https://server/federation/idp1/signin");

        response = await _host.BrowserClient.GetAsync(redirectUri);

        response.Headers.Location.ToString().Should().StartWith("/callback");

        response = await _host.BrowserClient.GetAsync(_host.Url("/callback"));

        response.StatusCode.Should().Be(HttpStatusCode.OK);
        var body = await response.Content.ReadAsStringAsync();

        body.Should().Be("1"); // sub
    }
示例#2
0
    public async Task challenge_should_trigger_authorize_request_to_dynamic_idp()
    {
        var response = await _host.HttpClient.GetAsync(_host.Url("/challenge?scheme=idp1"));

        response.StatusCode.Should().Be(HttpStatusCode.Redirect);
        response.Headers.Location.ToString().Should().StartWith("https://idp1/connect/authorize");
    }