private void AddTokenToMessage(Message message, TimeSpan timeout) { HttpRequestMessageProperty item; if (this.tokenProvider == null) { return; } this.ValidateTransportProtectionForToken(); string str = "Send"; if (message.Properties.ContainsKey(HttpRequestMessageProperty.Name)) { item = message.Properties[HttpRequestMessageProperty.Name] as HttpRequestMessageProperty; } else { item = new HttpRequestMessageProperty(); message.Properties.Add(HttpRequestMessageProperty.Name, item); } if (!this.tokenProvider.IsWebTokenSupported) { throw new NotSupportedException(SRClient.HTTPAuthTokenNotSupportedException); } string str1 = ServiceBusUriHelper.NormalizeUri(message.Headers.To ?? this.via, false); string webToken = this.tokenProvider.GetWebToken(str1, str, false, timeout); item.Headers["ServiceBusAuthorization"] = webToken; }
private string NormalizeAppliesTo(Uri namespaceAddress, string appliesTo) { if (namespaceAddress == null) { return(this.NormalizeAppliesTo(appliesTo)); } string str = (this.TokenScope != Microsoft.ServiceBus.TokenScope.Namespace || !(namespaceAddress != null) ? appliesTo : namespaceAddress.AbsoluteUri); return(ServiceBusUriHelper.NormalizeUri(str, "http", this.StripQueryParameters, false, true)); }
internal static string NormalizeUri(Uri uri, bool ensureTrailingSlash = false) { return(ServiceBusUriHelper.NormalizeUri(uri.AbsoluteUri, uri.Scheme, true, false, ensureTrailingSlash)); }
protected virtual string NormalizeAppliesTo(string appliesTo) { return(ServiceBusUriHelper.NormalizeUri(appliesTo, "http", this.StripQueryParameters, this.TokenScope == Microsoft.ServiceBus.TokenScope.Namespace, true)); }
protected override string NormalizeAppliesTo(string appliesTo) { return(ServiceBusUriHelper.NormalizeUri(appliesTo, "http", this.StripQueryParameters, false, false)); }