In my Application, I create on Client-side my own Principal-Object, which i set like

Thread.CurrentPrincipal = myPrincipal;

Now, when I call a WCF-Service (TCP/IP), I should also have this Principal in the Server-side Thread of this called WCF-Service. Is there something that I can configure to do this, or does I have to implement this myself?

Thanks for your hints.

有帮助吗?

解决方案

If we're talking about windows principals, look at WCF authentication and security options. It's not trivial.

If you have a custom principal object, then my suggestion is to implement message inspectors, serialize the principal inside a message header and unpack it on the other side. This works pretty well for us in a number of projects, and doesn't require any special WCF settings.

其他提示

this will be done implicitly as each request in WCF should have it's Iprincipal.Identity have you tried something like this in your server side

IPrincipal principal =   Thread.CurrentPrincipal;
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top