WCF 서비스가 있습니다. 내 서비스에는 각각 다른 연락처를 가진 2 개의 끝점이 있습니다. 이 서비스는 사용자 정의 사용자 이름 인증을 사용합니다 (아래의 customUserNamePasswordValidatorType 속성에 정의 됨). 두 엔드 포인트가 동일한 인증 방법을 사용한다는 것이 문제입니다.WCF 각 끝점마다 다른 인증 방법
어쨌든 각 엔드 포인트에 대해 서로 다른 인증 방법을 정의 할 수 있습니까?
각 끝점은 서로 다른 하나의 앱으로 액세스됩니다. 따라서 앱 이름을 인증 메소드에 전달할 수 있다면 무엇이 가능 할지도 모릅니다.
이
이 사용자 정의 인증 방법입니다 내의 app.config<services>
<service behaviorConfiguration="Behavior1" name="MyServer.Service">
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
<endpoint address="" binding="netTcpBinding" bindingConfiguration="Binding1" contract="MyServer.IService" />
<endpoint address="service2" binding="netTcpBinding" bindingConfiguration="Binding1" contract="MyServer.ISecondService" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:37100/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Behavior1">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata />
<serviceCredentials>
<userNameAuthentication customUserNamePasswordValidatorType="MyServer.Authentication" userNamePasswordValidationMode="Custom" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
입니다. appName이라는 세 번째 매개 변수를 전달하면 어떨까요?
public class Authentication : UserNamePasswordValidator
{
public override void Validate(string userName, string password)
{
}
}
감사
'서비스 요소'는 무엇을 의미합니까? – FrenkyB
app.config의 Services 요소 아래에있는 각 Service 요소입니다. – DaveB