コード例 #1
0
        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;
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 internal static string NormalizeUri(Uri uri, bool ensureTrailingSlash = false)
 {
     return(ServiceBusUriHelper.NormalizeUri(uri.AbsoluteUri, uri.Scheme, true, false, ensureTrailingSlash));
 }
コード例 #4
0
 protected virtual string NormalizeAppliesTo(string appliesTo)
 {
     return(ServiceBusUriHelper.NormalizeUri(appliesTo, "http", this.StripQueryParameters, this.TokenScope == Microsoft.ServiceBus.TokenScope.Namespace, true));
 }
コード例 #5
0
 protected override string NormalizeAppliesTo(string appliesTo)
 {
     return(ServiceBusUriHelper.NormalizeUri(appliesTo, "http", this.StripQueryParameters, false, false));
 }