internal async override Task PreRunAsync()
        {
            IAccount account = await GetAccountFromParamsOrLoginHintAsync(_silentParameters).ConfigureAwait(false);

            AuthenticationRequestParameters.Account = account;

            AuthenticationRequestParameters.Authority = Authority.CreateAuthorityForRequest(
                ServiceBundle.Config.AuthorityInfo,
                AuthenticationRequestParameters.AuthorityOverride,
                account?.HomeAccountId?.TenantId);
        }
示例#2
0
        public async Task PreRunAsync()
        {
            IAccount account = await GetAccountFromParamsOrLoginHintAsync(_silentParameters).ConfigureAwait(false);

            AuthenticationRequestParameters.Account = account;
            AuthenticationRequestParameters.SuggestedWebAppCacheKey = account.HomeAccountId?.Identifier;

            AuthenticationRequestParameters.Authority = Authority.CreateAuthorityForRequest(
                ServiceBundle.Config.AuthorityInfo,
                AuthenticationRequestParameters.AuthorityOverride,
                account.HomeAccountId?.TenantId);
        }
示例#3
0
        private async Task UpdateRequestWithAccountAsync()
        {
            IAccount account = await GetAccountFromParamsOrLoginHintAsync(
                _silentParameters.Account,
                _silentParameters.LoginHint).ConfigureAwait(false);

            AuthenticationRequestParameters.Account = account;

            AuthenticationRequestParameters.Authority = Authority.CreateAuthorityForRequest(
                ServiceBundle.Config.AuthorityInfo,
                AuthenticationRequestParameters.AuthorityOverride,
                account?.HomeAccountId?.TenantId);
        }
        internal async override Task PreRunAsync()
        {
            if (ServiceBundle.PlatformProxy.CanBrokerSupportSilentAuth() && AuthenticationRequestParameters.IsBrokerEnabled)
            {
                return;
            }

            IAccount account = await GetAccountFromParamsOrLoginHintAsync(_silentParameters).ConfigureAwait(false);

            AuthenticationRequestParameters.Account = account;

            AuthenticationRequestParameters.Authority = Authority.CreateAuthorityForRequest(
                ServiceBundle.Config.AuthorityInfo,
                AuthenticationRequestParameters.AuthorityOverride,
                account?.HomeAccountId?.TenantId);
        }
示例#5
0
        private async Task UpdateRequestWithAccountAsync()
        {
            IAccount account = await GetAccountFromParamsOrLoginHintAsync(
                _silentParameters.Account,
                _silentParameters.LoginHint).ConfigureAwait(false);

            AuthenticationRequestParameters.Account = account;

            // AcquireTokenSilent must not use "common" or "organizations". Instead, use the home tenant id.
            var tenantedAuthority = Authority.CreateAuthorityForRequest(
                AuthenticationRequestParameters.RequestContext.ServiceBundle.Config.AuthorityInfo,
                AuthenticationRequestParameters.AuthorityOverride,
                account?.HomeAccountId?.TenantId);

            AuthenticationRequestParameters.AuthorityManager =
                new AuthorityManager(
                    AuthenticationRequestParameters.RequestContext,
                    tenantedAuthority);
        }
        public AuthenticationRequestParameters(
            IServiceBundle serviceBundle,
            ITokenCacheInternal tokenCache,
            AcquireTokenCommonParameters commonParameters,
            RequestContext requestContext,
            string homeAccountId = null)
        {
            _serviceBundle    = serviceBundle;
            _commonParameters = commonParameters;

            Authority = Authority.CreateAuthorityForRequest(serviceBundle.Config.AuthorityInfo, commonParameters.AuthorityOverride);
            UserConfiguredAuthority = Authority;

            ClientId            = serviceBundle.Config.ClientId;
            CacheSessionManager = new CacheSessionManager(tokenCache, this);
            Scope              = ScopeHelper.CreateScopeSet(commonParameters.Scopes);
            RedirectUri        = new Uri(serviceBundle.Config.RedirectUri);
            RequestContext     = requestContext;
            IsBrokerConfigured = serviceBundle.Config.IsBrokerEnabled;

            // Set application wide query parameters.
            ExtraQueryParameters = serviceBundle.Config.ExtraQueryParameters ??
                                   new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);

            // Copy in call-specific query parameters.
            if (commonParameters.ExtraQueryParameters != null)
            {
                foreach (KeyValuePair <string, string> kvp in commonParameters.ExtraQueryParameters)
                {
                    ExtraQueryParameters[kvp.Key] = kvp.Value;
                }
            }

            ClaimsAndClientCapabilities = ClaimsHelper.GetMergedClaimsAndClientCapabilities(
                _commonParameters.Claims,
                _serviceBundle.Config.ClientCapabilities);

            HomeAccountId = homeAccountId;
        }
        // Regression https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/issues/1606
        public void DefaultAuthorityDifferentTypeTest()
        {
            Authority result = Authority.CreateAuthorityForRequest(s_commonAuthority, s_b2cAuthority, null);

            Assert.AreEqual(s_b2cAuthority.CanonicalAuthority, result.AuthorityInfo.CanonicalAuthority);
        }