12,163
社区成员
发帖
与我相关
我的任务
分享
public class MyUserValidate : UserNamePasswordValidator
{
public override void Validate(string userName, string password)
{
if (userName != "sa" || password != "sa")
{
throw new SecurityTokenException("用户名密码错误!");
}
else
{
}
}
}
<service name="HL7.Service.M.Dy.DyService" behaviorConfiguration="httpsBasicBindings">
<endpoint name="HL7.Service.M.Dy.DyService" address="" binding="wsHttpBinding" contract="HL7.Service.M.Dy.IDyService" bindingConfiguration="mybehaviorConfiguration">
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="https://127.0.0.1:9001/HL7/Dy" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="httpsBasicBindings">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceCredentials>
<serviceCertificate storeName="My" x509FindType="FindBySubjectName" findValue="HL7Server" storeLocation="LocalMachine"/>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="HL7.Service.Demo.MyUserValidate,HL7.Service.Demo" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="mybehaviorConfiguration">
<security mode="Transport">
<transport clientCredentialType="Basic"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>