WCF Service - User Director

In the constructor of my WCF service class, I set the current director as the main one passed in the message header:

Thread.CurrentPrincipal = OperationContext.Current.IncomingMessageHeaders.GetHeader<BBPrincipal>("bbPrincipal", "ns");

Everything seems to be working fine, however, when I came to the principal link in the method, Thread.CurrentPrincipal returned to WindowsPrincipal.

Presumably, this method runs in a different thread. How can I guarantee that a method uses the main set in the service constructor?

+3
source share
2 answers

I just found the answer to my original question. To stop WCF by overriding the principal with an empty one, set the following in the behavior configuration:

<serviceAuthorization principalPermissionMode="None" />

.

: http://connect.microsoft.com/VisualStudio/feedback/details/369445/wcf-service-configured-for-transport-security-shouldnt-change-thread-currentprincipal

+7

WCF AuthorizationPolicy, , , . .

+4

Source: https://habr.com/ru/post/1765591/


All Articles