J
J
Jarwis2017-02-07 15:08:59
WCF
Jarwis, 2017-02-07 15:08:59

Is it possible to inject WindowsIdentity into the constructor of a WCF service?

Good afternoon.
The question is, is it possible to inject WindowsIdentity (which of ServiceSecurityContext.Current.WindowsIdentity) somewhere with Autofac?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
basrach, 2017-06-25
@Jarwis

Can. Implement a factory that will lazily pull identity from the context, and resolve this factory in the service constructor. It is necessary to do this lazily, because the service instance is created before authorization, and the service method is called after successful authorization, respectively, at the time the service instance is created, the context will be anonymous or nothing, but there will definitely be something at the time the method is called. Therefore, we pull the factory on the method call and get the value from the context.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question