tags:

views:

21

answers:

0

Hello.

I have a customUserNamePasswordValidatorType and I want to set the service credentials 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;

If I set in the config then it does:

<serviceCredentials> <userNameAuthentication userNamePasswordValidationMode="Custom" $customUserNamePasswordValidatorType="Quad.WCF.Security.BigIPUsernamePasswordValidator, Quad.WCF" /> </serviceCredentials>

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?