private void SetSinkProperties(IMessage msg)
        {
            if (!_authenticationParamsSet)
            {
                String url = (String)msg.Properties["__Uri"];

                UrlAuthenticationEntry entr =
                    UrlAuthenticator.GetAuthenticationEntry(url);

                if (entr != null)
                {
                    IClientChannelSink last = this;

                    while (last.NextChannelSink != null)
                    {
                        last = last.NextChannelSink;
                    }

                    // last now contains the transport channel sink

                    last.Properties["username"] = entr.Username;
                    last.Properties["password"] = entr.Password;
                }



                _authenticationParamsSet = true;
            }
        }
Example #2
0
 public UrlAuthenticationSinkProvider(IDictionary properties, ICollection providerData)
 {
     foreach (SinkProviderData obj in providerData)
     {
         if (obj.Name == "url")
         {
             if (obj.Properties["base"] != null)
             {
                 UrlAuthenticator.AddAuthenticationEntry(
                     (String)obj.Properties["base"],
                     (String)obj.Properties["username"],
                     (String)obj.Properties["password"]);
             }
             else
             {
                 UrlAuthenticator.SetDefaultAuthenticationEntry(
                     (String)obj.Properties["username"],
                     (String)obj.Properties["password"]);
             }
         }
     }
 }