private static BrokerRequest FromAuthenticationParameters(AuthenticationRequestParameters _authenticationRequestParameters) { BrokerRequest br = new BrokerRequest(); br.Authority = _authenticationRequestParameters.Authority.AuthorityInfo.CanonicalAuthority; br.Scopes = EnumerableExtensions.AsSingleString(_authenticationRequestParameters.Scope); br.ClientId = _authenticationRequestParameters.ClientId; br.CorrelationId = _authenticationRequestParameters.RequestContext.CorrelationId.ToString(); br.ClientAppVersion = Application.Context.PackageManager.GetPackageInfo( Application.Context.PackageName, PackageInfoFlags.MatchAll).VersionName; br.ClientAppName = Application.Context.PackageName; br.ClientVersion = MsalIdHelper.GetMsalVersion(); br.RedirectUri = _authenticationRequestParameters.RedirectUri; if (!string.IsNullOrEmpty(br.Claims)) { br.Claims = _authenticationRequestParameters.Claims; } if (_authenticationRequestParameters.ExtraQueryParameters?.Any() == true) { string extraQP = string.Join("&", _authenticationRequestParameters.ExtraQueryParameters.Select(x => x.Key + "=" + x.Value)); br.ExtraQueryParameters = extraQP; } return(br); }
private Dictionary <string, string> CreateBrokerRequestDictionary( AuthenticationRequestParameters _authenticationRequestParameters, AcquireTokenInteractiveParameters acquireTokenInteractiveParameters) { var brokerRequest = new Dictionary <string, string>(16); brokerRequest.Add(BrokerParameter.Authority, _authenticationRequestParameters.Authority.AuthorityInfo.CanonicalAuthority); string scopes = EnumerableExtensions.AsSingleString(_authenticationRequestParameters.Scope); brokerRequest.Add(BrokerParameter.Scope, scopes); brokerRequest.Add(BrokerParameter.ClientId, _authenticationRequestParameters.ClientId); brokerRequest.Add(BrokerParameter.CorrelationId, _authenticationRequestParameters.RequestContext.CorrelationId.ToString()); brokerRequest.Add(BrokerParameter.ClientVersion, MsalIdHelper.GetMsalVersion()); brokerRequest.Add(BrokerParameter.Force, "NO"); brokerRequest.Add(BrokerParameter.RedirectUri, _authenticationRequestParameters.RedirectUri.AbsoluteUri); if (_authenticationRequestParameters.ExtraQueryParameters?.Any() == true) { string extraQP = string.Join("&", _authenticationRequestParameters.ExtraQueryParameters.Select(x => x.Key + "=" + x.Value)); brokerRequest.Add(BrokerParameter.ExtraQp, extraQP); } brokerRequest.Add(BrokerParameter.Username, _authenticationRequestParameters.Account?.Username ?? string.Empty); brokerRequest.Add(BrokerParameter.ExtraOidcScopes, BrokerParameter.OidcScopesValue); brokerRequest.Add(BrokerParameter.Prompt, acquireTokenInteractiveParameters.Prompt.PromptValue); brokerRequest.Add(BrokerParameter.Claims, _authenticationRequestParameters.ClaimsAndClientCapabilities); AddCommunicationParams(brokerRequest); return(brokerRequest); }
private Dictionary <string, string> CreateBrokerRequestDictionary( AuthenticationRequestParameters authenticationRequestParameters, AcquireTokenInteractiveParameters acquireTokenInteractiveParameters) { var brokerRequest = new Dictionary <string, string>(16); brokerRequest.Add(BrokerParameter.Authority, authenticationRequestParameters.Authority.AuthorityInfo.CanonicalAuthority); string scopes = EnumerableExtensions.AsSingleString(authenticationRequestParameters.Scope); brokerRequest.Add(BrokerParameter.Scope, scopes); brokerRequest.Add(BrokerParameter.ClientId, authenticationRequestParameters.ClientId); brokerRequest.Add(BrokerParameter.CorrelationId, authenticationRequestParameters.RequestContext.CorrelationId.ToString()); brokerRequest.Add(BrokerParameter.ClientVersion, MsalIdHelper.GetMsalVersion()); // this needs to be case sensitive because the AppBundle is case sensitive brokerRequest.Add(BrokerParameter.RedirectUri, authenticationRequestParameters.OriginalRedirectUriString); if (authenticationRequestParameters.ExtraQueryParameters?.Any() == true) { string extraQP = string.Join("&", authenticationRequestParameters.ExtraQueryParameters.Select(x => x.Key + "=" + x.Value)); brokerRequest.Add(BrokerParameter.ExtraQp, extraQP); } brokerRequest.Add(BrokerParameter.Username, authenticationRequestParameters.Account?.Username ?? string.Empty); brokerRequest.Add(BrokerParameter.ExtraOidcScopes, BrokerParameter.OidcScopesValue); brokerRequest.Add(BrokerParameter.Prompt, acquireTokenInteractiveParameters.Prompt.PromptValue); if (!string.IsNullOrEmpty(authenticationRequestParameters.Claims)) { brokerRequest.Add(BrokerParameter.Claims, authenticationRequestParameters.Claims); } AddCommunicationParams(brokerRequest); return(brokerRequest); }
internal void CreateRequestParametersForBroker() { BrokerPayload.Add(BrokerParameter.Authority, _authenticationRequestParameters.Authority.AuthorityInfo.CanonicalAuthority); string scopes = EnumerableExtensions.AsSingleString(_authenticationRequestParameters.Scope); BrokerPayload.Add(BrokerParameter.Scope, scopes); BrokerPayload.Add(BrokerParameter.ClientId, _authenticationRequestParameters.ClientId); BrokerPayload.Add(BrokerParameter.CorrelationId, _authenticationRequestParameters.RequestContext.Logger.CorrelationId.ToString()); BrokerPayload.Add(BrokerParameter.ClientVersion, MsalIdHelper.GetMsalVersion()); BrokerPayload.Add(BrokerParameter.RedirectUri, _serviceBundle.Config.RedirectUri); string extraQP = string.Join("&", _authenticationRequestParameters.ExtraQueryParameters.Select(x => x.Key + "=" + x.Value)); BrokerPayload.Add(BrokerParameter.ExtraQp, extraQP); BrokerPayload.Add(BrokerParameter.ExtraOidcScopes, BrokerParameter.OidcScopesValue); BrokerPayload.Add(BrokerParameter.LoginHint, _silentParameters.LoginHint); #pragma warning disable CA1305 // Specify IFormatProvider BrokerPayload.Add(BrokerParameter.ForceRefresh, _silentParameters.ForceRefresh.ToString()); #pragma warning restore CA1305 // Specify IFormatProvider }
internal void CreateRequestParametersForBroker() { BrokerPayload.Clear(); BrokerPayload.Add(BrokerParameter.Authority, _authenticationRequestParameters.Authority.AuthorityInfo.CanonicalAuthority); string scopes = EnumerableExtensions.AsSingleString(_authenticationRequestParameters.Scope); BrokerPayload.Add(BrokerParameter.Scope, scopes); BrokerPayload.Add(BrokerParameter.ClientId, _authenticationRequestParameters.ClientId); BrokerPayload.Add(BrokerParameter.CorrelationId, _authenticationRequestParameters.RequestContext.Logger.CorrelationId.ToString()); BrokerPayload.Add(BrokerParameter.ClientVersion, MsalIdHelper.GetMsalVersion()); BrokerPayload.Add(BrokerParameter.Force, "NO"); BrokerPayload.Add(BrokerParameter.RedirectUri, _serviceBundle.Config.RedirectUri); string extraQP = string.Join("&", _authenticationRequestParameters.ExtraQueryParameters.Select(x => x.Key + "=" + x.Value)); BrokerPayload.Add(BrokerParameter.ExtraQp, extraQP); BrokerPayload.Add(BrokerParameter.Username, _authenticationRequestParameters.Account?.Username ?? string.Empty); BrokerPayload.Add(BrokerParameter.ExtraOidcScopes, BrokerParameter.OidcScopesValue); }