示例#1
0
        public async Task ValidateCcsHeadersForInteractiveAuthCodeFlowAsync()
        {
            HttpSnifferClientFactory factory = null;
            LabResponse labResponse          = await LabUserHelper.GetDefaultUserAsync().ConfigureAwait(false);

            var pca = PublicClientApplicationBuilder
                      .Create(labResponse.App.AppId)
                      .WithDefaultRedirectUri()
                      .WithRedirectUri(SeleniumWebUI.FindFreeLocalhostRedirectUri())
                      .WithTestLogging(out factory)
                      .Build();

            AuthenticationResult authResult = await pca
                                              .AcquireTokenInteractive(s_scopes)
                                              .WithPrompt(Prompt.SelectAccount)
                                              .WithCustomWebUi(CreateSeleniumCustomWebUI(labResponse.User, Prompt.SelectAccount))
                                              .ExecuteAsync(new CancellationTokenSource(_interactiveAuthTimeout).Token)
                                              .ConfigureAwait(false);


            var CcsHeader    = TestCommon.GetCcsHeaderFromSnifferFactory(factory);
            var userObjectId = labResponse.User.ObjectId;
            var userTenantID = labResponse.User.TenantId;

            Assert.AreEqual($"X-AnchorMailbox:Oid:{userObjectId}@{userTenantID}", $"{CcsHeader.Key}:{CcsHeader.Value.FirstOrDefault()}");

            Assert.IsNotNull(authResult);
            Assert.IsNotNull(authResult.AccessToken);
        }
示例#2
0
        private void AssertCcsRoutingInformationIsSent(HttpSnifferClientFactory factory, LabResponse labResponse)
        {
            if (labResponse.User.FederationProvider != FederationProvider.None)
            {
                return;
            }

            var CcsHeader = TestCommon.GetCcsHeaderFromSnifferFactory(factory);

            if (!String.IsNullOrEmpty(CcsHeader.Value?.FirstOrDefault()))
            {
                ValidateCcsHeader(CcsHeader, labResponse);
            }
        }
        private void AssertCcsRoutingInformationIsSent(HttpSnifferClientFactory factory, LabResponse labResponse)
        {
            var CcsHeader = TestCommon.GetCcsHeaderFromSnifferFactory(factory);

            Assert.AreEqual($"X-AnchorMailbox:UPN:{labResponse.User.Upn}", $"{CcsHeader.Key}:{CcsHeader.Value.FirstOrDefault()}");
        }