If you refer to this section (WCF Security: Obtaining a User Password) by Rory Primrose , it does the same as asking for a custom validator, an important extension method is CreateSecurityTokenManager :
public class PasswordServiceCredentials : ServiceCredentials { public PasswordServiceCredentials() { } private PasswordServiceCredentials(PasswordServiceCredentials clone) : base(clone) { } protected override ServiceCredentials CloneCore() { return new PasswordServiceCredentials(this); } public override SecurityTokenManager CreateSecurityTokenManager() {
To use these custom service credentials, you need to specify the type attribute in the <ServiceCredentials> ConfigurationElement in your configuration, for example:
<serviceCredentials type="your.assembly.namespace.PasswordServiceCredentials, your.assembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" > </serviceCredentials>
Similarly, you can set this type attribute programmatically, but I don't know how to do it.
Rabid
source share