I have a custom UserNamePasswordValidator and I am setting it to be used in code in an IServiceBehavior ApplyDispatchBehavior() implementation.
If I set it in code like this the problem is the validator never executes:
serviceHostBase.Credentials.UserNameAuthentication.CustomUserNamePasswordValidator = new BigIPUsernamePasswordValidator(); serviceHostBase.Credentials.UserNameAuthentication.UserNamePasswordValidationMode = UserNamePasswordValidationMode.Custom;
The behavior is set as an attribute on the service class and if I set a breakpoint I can see the above code being executed.
It’s my understanding everything in the configuration should be able to be set in code. But this doesn’t work when setting it in the IServiceBehavior ApplyDispatchBehavior() implementation.
Any one have any idea if this should be working or how I should be doing it differently through code?
Try using the message security mode with client credential type set to username. I’ve just tested it by applying the validator through the ApplyDispatchBehavior method and it works.Regards,Stipe Ivan/
No that didn’t help. Are you setting a custom validator? Can I see your code?
I’ve coded a little demo for you: