Hello, I know it's been a while, but do you happen to have a code snippet 
of how did you get this working? I have tried to ask in a new thread but 
haven't got any answers at all. 

Best regards.

On Thursday, January 28, 2010 9:03:33 AM UTC+2, ohaga wrote:
>
> AbstractChannelFactoryAware worked like a charm!!
>
> Thanks.
>
> On Jan 27, 2:48 pm, Craig Neuwirt <[email protected]> wrote:
> > You should register and IChannelFactoryAware class in the container
> > e.g
> >
> >         public class UserNameClientCredentials : 
> AbstractChannelFactoryAware
> >         {
> >                 public string UserName { get; set; }
> >
> >                 public string Password { get; set; }
> >
> >                 public override void Created(ChannelFactory 
> channelFactory)
> >                 {
> >                         channelFactory.Credentials.UserName.UserName =
> > UserName;
> >                         channelFactory.Credentials.UserName.Password =
> > Password;
> >                 }
> >         }
> >
> >
> >
> > On Wed, Jan 27, 2010 at 12:19 AM, ohaga <[email protected]> wrote:
> > > I am working on a project where we are using WcfIntegration to create
> > > client-proxies. Typical code is shown i text below:
> >
> > > public void Init()
> > > {
> > > var container = new WindsorContainer();
> > > container.AddFacility<WcfFacility>();
> > > WSHttpBinding binding;
> > > binding = new WSHttpBinding
> > > (SecurityMode.TransportWithMessageCredential);
> > > binding.Security.Message.ClientCredentialType =
> > > MessageCredentialType.UserName;
> >
> > > var endpoint = WcfEndpoint.BoundTo(binding).At("http://localhost/
> > > myservice.svc");
> > > var defaultClientModel = new DefaultClientModel()
> > > {
> > > Endpoint = endpoint
> > > };
> > > var s = typeof (IMyService);
> > > container.Register(Component.For(s).ActAs(defaultClientModel));
> > > }
> >
> > > I want to add something like this code:
> > > var credentials = new ClientCredentials();
> > > credentials.UserName.UserName = "username";
> > > credentials.UserName.Password = "password";
> > > defaultClientModel.AddExtensions(credentials);
> >
> > > But I get an error when the channel is created (credentials already
> > > added).
> >
> > > A possible workaround (hack) is to change the code in
> > > WcfExplicitExtension.Install(ServiceEndpoint endpoint, bool
> > > withContract, IKernel kernel, IWcfBurden burden)
> > > {
> > > object extension = GetExtensionInstance(kernel, burden);
> > > if (extension is ClientCredentials)
> > > {
> > > var config = (ClientCredentials)extension;
> > > var credentials = endpoint.Behaviors.Find<ClientCredentials>();
> > > credentials.UserName.Password = config.UserName.Password;
> > > credentials.UserName.UserName = config.UserName.UserName;
> > > }
> > > else if (extension is IEndpointBehavior)
> > > {
> > > endpoint.Behaviors.Add((IEndpointBehavior)extension);
> > > }
> >
> > > Could we use another approach to achieve the same thing?
> >
> > > --
> > > You received this message because you are subscribed to the Google 
> Groups
> > > "Castle Project Users" group.
> > > To post to this group, send email to 
> > > [email protected]<javascript:>
> > > .
> > > To unsubscribe from this group, send email to
> > > [email protected] 
> > > <javascript:><castle-project-users%2Bun 
> [email protected] <javascript:>>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/castle-project-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to