Get User Identity #422
Unanswered
kraftDeveloper
asked this question in
Q&A
Replies: 2 comments 13 replies
-
generally we should be able to get from OperationContext.. looks like CoreWCF is not populating in above situation.. please create an issue for me to debug... you should be able to get it from OperationContext, if your binding is TransportWithMessageCredential and Message.ClientCredentialType is Windows. |
Beta Was this translation helpful? Give feedback.
2 replies
-
You can get the HttpContext from the message properties. So you can go something like this:
|
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello CoreWCF Community, I am trying to get the user identity of the client consumer from the current Http context with the following code:
var userIdentity = this.httpContextAccessor.HttpContext.User.Identity.Name;
Unfortunately, the Identity.Name property is always NULL in my case.
I am using a WSHttpBinding with Transport SecurityMode. The same binding works fine in classic WCF service to get the user identity this way.
The
httpContextAccessor
instance is injected on theCreateHostBuilder
method byservices.AddHttpContextAccessor();
and given to the CoreWCF service instance in constructorCan someone help me in this case?
Beta Was this translation helpful? Give feedback.
All reactions