Exemple #1
0
        public AuthenticationRequestParameters(
            IServiceBundle serviceBundle,
            ITokenCacheInternal tokenCache,
            AcquireTokenCommonParameters commonParameters,
            RequestContext requestContext)
        {
            _serviceBundle    = serviceBundle;
            _commonParameters = commonParameters;

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

            ClientId            = serviceBundle.Config.ClientId;
            CacheSessionManager = new CacheSessionManager(tokenCache, this);
            Scope              = ScopeHelper.CreateSortedSetFromEnumerable(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>();

            // 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);
        }
Exemple #2
0
        public void ClaimsMerge_NoClaims_Test()
        {
            var mergedJson = ClaimsHelper.GetMergedClaimsAndClientCapabilities(
                null,
                TestConstants.ClientCapabilities);

            Assert.AreEqual(TestConstants.ClientCapabilitiesJson, mergedJson);
        }
Exemple #3
0
        public void ClaimsMerge_NoCapabilities_Test()
        {
            var mergedJson = ClaimsHelper.GetMergedClaimsAndClientCapabilities(
                TestConstants.Claims,
                new string[0]);

            Assert.AreEqual(TestConstants.Claims, mergedJson);
        }
        public AuthenticationRequestParameters(
            IServiceBundle serviceBundle,
            ITokenCacheInternal tokenCache,
            AcquireTokenCommonParameters commonParameters,
            RequestContext requestContext,
            Authority initialAuthority,
            string homeAccountId = null)
        {
            _serviceBundle    = serviceBundle;
            _commonParameters = commonParameters;
            RequestContext    = requestContext;

            CacheSessionManager = new CacheSessionManager(tokenCache, this);
            Scope            = ScopeHelper.CreateScopeSet(commonParameters.Scopes);
            RedirectUri      = new Uri(serviceBundle.Config.RedirectUri);
            AuthorityManager = new AuthorityManager(RequestContext, initialAuthority);

            // 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;
        }