Es posible utilizar 2 tipos de autenticaciones: ventanas y nombre de usuario en wcf, utilizando el Modo de seguridad de mensajes y el certificado para autenticar. Mi Nombre de usuario cfg/código es:
servidor CFG:
WCF Autenticación mixta Nombre de usuario y ventanas
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceCredentialsBehavior">
<serviceCredentials>
<serviceCertificate findValue="cn=cool" storeName="TrustedPeople" storeLocation="CurrentUser" />
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Util.CustomUserNameValidator, Util" />
</serviceCredentials>
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="ServiceCredentialsBehavior" name="Service">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="MessageAndUserName" name="SecuredByTransportEndpoint" contract="IService"/>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="MessageAndUserName">
<security mode="Message">
<message clientCredentialType="UserName"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<client/>
</system.serviceModel>
<system.web>
<compilation debug="true"/>
</system.web>
</configuration>
cfg Cliente:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="LocalCertValidation">
<clientCredentials>
<serviceCertificate>
<authentication certificateValidationMode="PeerTrust" trustedStoreLocation="CurrentUser" />
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IService" >
<security mode="Message">
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:48097/WCFServer/Service.svc"
binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IService"
contract="ServiceReference1.IService"
name="WSHttpBinding_IService" behaviorConfiguration="LocalCertValidation">
<identity>
<dns value ="cool" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
qué hay que cambiar, el servidor saber ventanas identidad que acceder a ella?
No, no funciona. ¿Tal vez no configuro correctamente las credenciales de Windows y cómo recuperarlas del servidor? – croisharp
¿Realmente necesita 2 métodos de autenticación diferentes? Puede pasar las credenciales de Windows del cliente al servicio y permitir que el servicio [suplante al usuario] (http://www.danrigsby.com/blog/index.php/2008/04/17/impersonate-a-clients- identidad-en-wcf /). Esta podría ser una mejor solución que intentar mezclar y combinar tipos de autenticación. Si desea verificar los nombres de usuario, puede almacenarlos en la base de datos y compararlos con los datos del usuario del cliente suplantado en el objeto devuelto por 'WindowsIdentity.GetCurrent()' (es mejor almacenar el sid, porque se puede cambiar un nombre de usuario).) – Franchesca
Sí, necesito 2 auth. métodos + autorización con NetSqlAzMan, pero sé cómo hacerlo, este es mi problema con la autenticación mixta .. – croisharp