New day - new perspective.
I got it with this..
var binding = new
BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
binding.Security.Transport.ClientCredentialType =
HttpClientCredentialType.Ntlm;
Container = new WindsorContainer()
.AddFacility<WcfFacility>
.Register(Component.For<IService1>()
.AsWcfClient(new DefaultClientModel(WcfEndpoint.BoundTo(binding)
.At("http://localhost/service1.svc"))
.Credentials(new UserNameCredentials("user1", "pass1"))))
.Register(Component.For<IService2>()
.AsWcfClient(new DefaultClientModel(WcfEndpoint.BoundTo(binding)
.At("http://localhost/service2.svc"))
.Credentials(new UserNameCredentials("user2", "pass2"))))
On Jul 28, 6:15 pm, JeffG <[email protected]> wrote:
> Using the following..
>
> Container = new WindsorContainer()
> .AddFacility<WcfFacility>
> .Register(Component.For<IService1>().AsWcfClient(WcfEndpoint.At("http://
> localhost/service1.svc")))
> .Register(Component.For<IService2>().AsWcfClient(WcfEndpoint.At("http://
> localhost/service2.svc")));
>
> How do I set separate UserNameCredentials for each?
>
> On Jul 7, 10:42 am, Craig Neuwirt <[email protected]> wrote:
>
>
>
>
>
>
>
> > There is already a UserNameCredentials class in WcfFacility. You should be
> > able to register an instance of that
> > class in the container and update the UserName/Password when it is
> > available. The facility should use that instance
> > each time.
>
> > On Jul 6, 2011, at 10:00 AM, Nicolás Sabena wrote:
>
> > > Hi. I'm trying to use the WCFFacility to access a service.
> > > With plain WCF, I used a MyServiceClient: ClientBase<IMyService>,
> > > setting the username and password provided by the user:
>
> > > using (var service = new MyServiceClient())
> > > {
> > > service.ClientCredentials.UserName.UserName = username;
> > > service.ClientCredentials.UserName.Password = password;
> > > service.Authenticate();
> > > }
>
> > > I read about doing this with a IChannelFactoryAware implementation,
> > > using the Created() notification.
>
> > > Problem is: I don't know the username and password when registering
> > > components in the container. The authentication data is entered by the
> > > user, and with this data I have to call (once) this service (I should
> > > "remember" the username and password, this is to be called only once
> > > after login).
>
> > > How should I set the username and password at runtime, just for this
> > > service, after the user provides the information?
>
> > > --
> > > 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].
> > > To unsubscribe from this group, send email to
> > > [email protected].
> > > For more options, visit this group
> > > athttp://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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.