diff --git a/docs/framework/wcf/feature-details/how-to-authenticate-with-a-user-name-and-password.md b/docs/framework/wcf/feature-details/how-to-authenticate-with-a-user-name-and-password.md index 5d9dc99797cb2..1d7f54d581ceb 100644 --- a/docs/framework/wcf/feature-details/how-to-authenticate-with-a-user-name-and-password.md +++ b/docs/framework/wcf/feature-details/how-to-authenticate-with-a-user-name-and-password.md @@ -1,18 +1,13 @@ --- title: "How to: Authenticate with a User Name and Password" -ms.custom: "" ms.date: "03/30/2017" ms.prod: ".net-framework" -ms.reviewer: "" -ms.suite: "" ms.technology: - "dotnet-clr" -ms.tgt_pltfrm: "" ms.topic: "article" helpviewer_keywords: - "authentication [WCF], user name and password" ms.assetid: a5415be2-0ef3-464c-9f76-c255cb8165a4 -caps.latest.revision: 18 author: "dotnet-bot" ms.author: "dotnetcontent" manager: "wpickett" @@ -20,15 +15,16 @@ ms.workload: - "dotnet" --- # How to: Authenticate with a User Name and Password + This topic demonstrates how to enable a [!INCLUDE[indigo1](../../../../includes/indigo1-md.md)] service to authenticate a client with a Windows domain username and password. It assumes you have a working, self-hosted WCF service. For an example of creating a basic self-hosted WCF service see, [Getting Started Tutorial](../../../../docs/framework/wcf/getting-started-tutorial.md). This topic assumes the service is configured in code. If you would like to see an example of configuring a similar service using a configuration file see [Message Security User Name](../../../../docs/framework/wcf/samples/message-security-user-name.md) - To configure a service to authenticate its clients using Windows Domain username and passwords use the < `xref:System.ServiceModel.WsHttpBinding`> and set its `Security.Mode` property to `Message`. In addition you must specify an X509 certificate that will be used to encrypt the username and password as they are sent from the client to the service. + To configure a service to authenticate its clients using Windows Domain username and passwords use the and set its `Security.Mode` property to `Message`. In addition you must specify an X509 certificate that will be used to encrypt the username and password as they are sent from the client to the service. On the client, you must prompt the user for the username and password and specify the user’s credentials on the WCF client proxy. -### To configure a WCF service to authenticate using Windows domain username and password. +## To configure a WCF service to authenticate using Windows domain username and password -1. Create an instance of the < `xref:System.ServiceModel.WsHttpBinding`>, set the security mode of the binding to `SecurityMode.Message`, set the `ClientCredentialType` of the binding to `MessageCredentialType.UserName`, and add a service endpoint using the configured binding to the service host as shown in the following code: +1. Create an instance of the , set the security mode of the binding to `SecurityMode.Message`, set the `ClientCredentialType` of the binding to `MessageCredentialType.UserName`, and add a service endpoint using the configured binding to the service host as shown in the following code: ``` // ... @@ -49,7 +45,7 @@ This topic demonstrates how to enable a [!INCLUDE[indigo1](../../../../includes/ You can use your own certificate, just modify the code to refer to your certificate. For more information about creating and using certificates see [Working with Certificates](../../../../docs/framework/wcf/feature-details/working-with-certificates.md). Make sure the certificate is in the Trusted People certificate store for the Local Machine. You can do this by running mmc.exe and selecting the **File**, **Add/Remove Snap-in...** menu item. In the **Add or Remove Snap-ins** dialog, select the **Certificates snap-in** and click **Add**. In the Certificates Snap-in dialog select **Computer account**. By default the certificate generated from the Message Security User name sample will be located in the Personal/Certificates folder. It will be listed as "localhost" under the Issued to column in the MMC window. Drag and drop the certificate into the **Trusted People** folder. This will allow WCF to treat the certificate as a trusted certificate when performing authentication. -### To call the service passing username and password +## To call the service passing username and password 1. The client application must prompt the user for their username and password. The following code asks the user for username and password. @@ -90,7 +86,7 @@ This topic demonstrates how to enable a [!INCLUDE[indigo1](../../../../includes/ ``` ## See Also - < `xref:System.ServiceModel.WsHttpBinding`> +