I am building a custom UserNamePasswordValidator for a WCF service. I am wiring up the service with Autofac + WCF/multitenant, all fitting neatly together. However I'm not sure what strategy to use to wire/implement this authentication class.
Ideally, I would start with
public class MyValidator : UserNamePasswordValidator {
public MyValidator(Func<Owned<IMyUserService>> userservicefactory) {
...
}
}
However, this isn't strictly possible because of the way that a UserNamePasswordValidator is consumed by WCF (the only option appears to be parameterless constructor).
So, questions:
- Am I correct or is there some WCF config voodoo with which a UserNamePasswordValidator factory can be configured?
- If "no", what is the most "DI-correct" fallback strategy that can be used in this scenario?