This sample demonstrates how to use an issuer name and issuer secret to authenticate with the Service Bus.
The sample is similar to the Echo sample, with a few changes. Specifically,
this sample adds a behavior in the ServiceHost
(service side) and ChannelFactory
(client side).
Prerequisites
If you haven't already done so, please read the release notes document that explains how to sign up for a Windows Azure account and how to configure your environment.
Service
Please refer to the Echo sample for information about how the service is defined and configured.
Client
Please refer to the Echo sample for information about how the client is defined and configured.
In this sample, both the client and the service use the same credential; therefore, no additional steps are required to grant the client access to listen or send a message to the service through the Service Bus. By default, a credential is granted with Listen, Send, and Manage privileges within its own Service Bus service namespace. If the client is using a different credential than the service, a specific Access Control rule is needed for a client credential to gain Listen, Send or Manage privileges in the Service Bus service namespace for the service. For more information about creating Access Control rules, please see the ManagementService sample from the Access Control Samples .
Building and Running the Sample
First, build the solution in Visual Studio or from the command line. To run the application, do the following:
- From a command prompt, run the service
(Service\bin\Debug\Service.exe).
- When prompted, enter the Service Namespace, the issuer name
(e.g. "owner") and secret. When
authorized, the service indicates that it is listening at the configured
address.
- From another command prompt, run the client
(Client\bin\Debug\Client.exe).
- When prompted, type your issuer name (e.g. "owner"), and the secret and the service namespace to which
you want to connect. Enter a line of text to send to the service, then press Enter.
- When finished, press Enter to exit the client and the
service.
Expected Output – Client
Enter the name of the Service Namespace you want to connect to: <service-namespace>
Your Issuer Name: owner
Your Issuer Secret: <issuer-secret>
Enter text to echo (or [Enter] to exit):
a
Server echoed: a
b
Server echoed: b
c
Server echoed: c |
Expected Output – Service
Your Service Namespace: <service-namespace> Your Issuer Name: owner Your Issuer Secret: <Issuer Secret> Service address: sb://<service-namespace>.servicebus.windows.net/SharedSecretAuthenticationService/[Enter] to exit Echoing: a Echoing: b Echoing: c |
Did you find this information useful? Please send your suggestions and comments about the documentation.