Пример #1
0
        public async Task Shared_session_id_should_be_included_in_anonymous_access_token_always()
        {
            var url = _mockPipeline.CreateAuthorizeUrl(
                clientId: "client2",
                responseType: "id_token token",
                scope: "openid api2",
                redirectUri: "https://client2/callback",
                state: "123_state",
                nonce: "123_nonce",
                acrValues: "0",
                responseMode: "json");
            var response = await _mockPipeline.BrowserClient.GetAsync(url);

            var result = JObject.Parse(await response.Content.ReadAsStringAsync());
            var token  = _mockPipeline.ReadJwtToken(((string)result["access_token"]));

            token.Claims.Should().Contain(c => c.Type == JwtClaimTypes.SharedSessionId);
        }
Пример #2
0
        public async Task Shared_session_id_should_be_included_in_anonymous_access_token_always()
        {
            var url = _mockPipeline.CreateAuthorizeUrl(
                clientId: "client4",
                responseType: "code",
                scope: "openid",
                redirectUri: "https://client4/callback",
                state: "123_state",
                nonce: "123_nonce",
                acrValues: "0",
                responseMode: "json");
            var response = await _mockPipeline.BrowserClient.GetAsync(url);

            var result        = JObject.Parse(await response.Content.ReadAsStringAsync());
            var tokenResponse = await _mockPipeline.BrowserClient.RequestAuthorizationCodeTokenAsync(new AuthorizationCodeTokenRequest()
            {
                Code        = (string)result["code"],
                RedirectUri = "https://client4/callback",
                Address     = IdentityServerPipeline.TokenEndpoint,
                ClientId    = "client4",
            });

            var token = _mockPipeline.ReadJwtToken(tokenResponse.AccessToken);

            token.Claims.Should().Contain(c => c.Type == JwtClaimTypes.SharedSessionId);
        }