WCF customUserNamePasswordValidatorType -


I have a custom user name password wiatator and I want to set service credentials in the code in an IServiceBehavior ApplyDispatchBehavior () implementation. I am

If I set it to code like this then the problem is that the verifier is never executed:

  serviceHostBase.Credentials.UserNameAuthentication.CustomUserNamePasswordValidator = new BigIPUsername PasswordValidator (); ServiceHostBase.Credentials.UserNameAuthentication.UserNamePasswordValidationMode = Username Password ValidationMode.Custom;  

If I set it to Config, then it does:

& lt; ServiceCredentials & gt; & Lt; UserNameAuthentication userNamePasswordValidationMode = "custom" $ customUserNamePasswordValidatorType = "Quad.WCF.Security.BigIPU Name Name PasswordValidator, Quad.WCF" /> & Lt; / ServiceCredentials & gt;

Behavior is set as a feature on the service class and if I set a breakpoint I can see it by executing the code above.

In this I understand everything should be able to be set in the code in the configuration. But it does not work when setting in the IServiceBehavior ApplyDispatchBehavior () implementation.

Anyone have any idea if this should work or should I do this code differently?

I have implemented it and it works:

  ServiceHost customServiceHost = New ServiceHost (type); CustomServiceHost.Credentials.UserNameAuthentication.UserNamePasswordValidationMode = System.ServiceModel.Security.UserNamePasswordValidationMode.Custom; CustomServiceHost.Credentials.UserNameAuthentication.CustomUserNamePasswordValidator = New MyCustomUserNameValidator (); CustomServiceHost.AddServiceEndpoint (type (IServiceContract), custombending, "https: // localhost: 443"); CustomServiceHost.Open ();  

My custom verifier is as simple (example, do not use one like this!)

  public class MyCustomUserNameValidator: UserNamePasswordValidator {public override zero Valid (String Username, String Password) {// Example Only Return; }}  

Do you get a specific exception or does it not appear to call only?


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -