J'ai suivi de nombreux articles msdn et le guidage codeplex, mais je ne peux pas utiliser WCF pour fonctionner avec l'authentification et la délégation Kerberos et j'apprécierais un peu d'aide.Authentification WCF et Kerberos
Configuration
J'ai le service WCF dans un site Web IIS sur une machine distante
- IIS 6.0 sur Windows 2003 R2 - SP 2
- Le SPN de la machine a été ajoutée (http/myserver & & http/myserver: 8080)
- Un compte AD a été créé pour le pool d'applications IIS
- Le compte AD a le réglage, autoriser la délégation (pour Kerberos), la valeur true
J'utilise Brian Booth's debug site sur 8080 et le site passe à toutes les exigences pour la délégation Kerberos. Le site IIS de débogage a désactivé l'authentification anonyme et l'authentification Windows intégrée. Je ai mis en miroir ces paramètres pour le site hébergeant le service WCF en miroir.
Web Service - Config Web (Original)
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WsHttpBindingConfig">
<security>
<message negotiateServiceCredential="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="ServiceBehavior" name="Service">
<endpoint address=""
binding="wsHttpBinding"
bindingConfiguration="WsHttpBindingConfig"
contract="IService">
<identity>
<servicePrincipalName value="http/myserver" />
<dns value="" />
</identity>
</endpoint>
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceAuthorization
impersonateCallerForAllOperations="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Web Service - Méthode Web
[OperationBehavior(Impersonation = ImpersonationOption.Required)]
public string GetCurrentUserName()
{
string name = WindowsIdentity.GetCurrent().Name;
return name;
}
App Client - App Config
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IService"
... />
...
<security mode="Message">
<transport clientCredentialType="Windows"
proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows"
negotiateServiceCredential="true"
algorithmSuite="Default"
establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://myserver/Service.svc"
binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IService"
contract="KerberosService.IService"
name="WSHttpBinding_IService">
<identity>
<servicePrincipalName value="http/myserver" />
</identity>
</endpoint>
</client>
</system.serviceModel>
Erreur d'application
L'erreur suivante se produit lorsque mon application de test, une application WinForms, tente d'appeler la méthode Web:
« La requête HTTP est non autorisée avec système d'authentification client 'Anonymous' . L'en-tête d'authentification reçu du serveur était 'Negotiate, NTLM' «
Event Log
L'erreur suivante est dans le journal des événements:.
Exception: système .ServiceModel.ServiceActivationException: Le service '/Service.svc' ne peut pas être activé en raison d'une exception tion. Le message d'exception est: Les paramètres de sécurité pour ce service nécessitent une authentification 'Anonyme' mais il n'est pas activé pour l'application IIS qui héberge ce service.
Ce que je ne comprends pas. Le but de ce service est de ne pas autoriser l'authentification anonyme, chaque utilisateur/requête doit être authentifié à l'aide de tickets Kerberos, puis transmis aux autres machines.
Comment dois-je configurer ce service WCF pour l'authentification et la délégation Kerberos?
Révision 1
Après avoir lu this SO question j'ai supprimé le point final de métadonnées. Cela n'a pas résolu le problème.
Révision 2
Après plus des recherches que j'ai trouvé quelques messages suggérant de changer wsHttpBinding à basicHttpBinding. La modification de cette partie du fichier web.config a été incluse ci-dessous et le point de terminaison du service a été mis à jour pour faire référence à cette liaison.
Web Service - Config Web (révisée)
<basicHttpBinding>
<binding name="basicBindingConfig">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows"
proxyCredentialType="Windows"
realm="" />
</security>
</binding>
</basicHttpBinding>
App Client - App Config (révisée)
<!-- ... -->
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows"
proxyCredentialType="Windows"
realm="" />
<message clientCredentialType="UserName"
algorithmSuite="Default" />
</security>
<!-- ... -->
erreur (révisée)
Le courant erreur semble contenir un autel Kerberos en-tête de recherche.
La requête HTTP est non autorisée avec système d'authentification client 'Négociez'. L'en-tête d'authentification reçue du serveur était « Négociez SOMEHUGESCARYKEYHERE
Remarque, j'ai posté et supprimé quelque chose de similaire hier, cet article comprend des révisions basées sur plus de recherche et devrait être plus propre à lire. – blu
J'ai ajouté la config d'application révisée basée sur les commentaires de marc_s. – blu