WCF安全模式是使用UserName的TransportWithMessageCredential,在哪里验证?

时间:2009-01-22 16:05:02

标签: .net wcf security

以下是我的WCF服务的web.config的一部分:

<bindings>
      <basicHttpBinding>
        <binding name="sslBinding">
          <security mode="TransportWithMessageCredential">
            <message clientCredentialType="UserName" algorithmSuite="Default" />
            <transport />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>

当客户端尝试使用我的服务时,我究竟在哪里检查用户名?是否有一些方法我必须覆盖以验证用户名?

1 个答案:

答案 0 :(得分:6)

<behaviors>
        <serviceBehaviors>
          <behavior name="behavior">
            <serviceCredentials>
              <userNameAuthentication customUserNamePasswordValidatorType="myType, assembly" userNamePasswordValidationMode="Custom"/>
            </serviceCredentials>
          </behavior>
        </serviceBehaviors>