views:

68

answers:

1

I have a backend service and front-end services. They communicate via the trusted subsystem pattern. I want to transfer a username from the frontend to the backend and do this via username credentials as found here:

http://msdn.microsoft.com/en-us/library/ms730288.aspx

This does not work in our scenerio where the front-end builds a backend service channel factory via:

channelFactory = new ChannelFactory<IBackEndService>(.....);

Creating a new channel is done via die channel factory. I can only set the credentials one time after that I get an exception that the username object is read-only.

channelFactory.Credentials.Username.Username = "myCoolFrontendUser";
var channel = channelFactory.CreateChannel();

Is there a way to create the channel factory only one time as this is expensive to create and then specify username credential when creating a channel?

A: 

I found out that this is not possible. I know add a custom header value to each call that identifies the user. You need to do this as you do not want to create a factory for each user that could hit your front-end. Besides that, creating factories is expensive.

Ramon