Exportar (0) Imprimir
Expandir todo
Expandir Minimizar

Enumeración RelayClientAuthenticationType

Describe si los clientes de un servicio tienen que presentar un token de seguridad emitido por el Control de acceso de Windows Azure a Windows Azure Service Bus cuando envían mensajes.

Espacio de nombres:  Microsoft.ServiceBus
Ensamblado:  Microsoft.ServiceBus (en Microsoft.ServiceBus.dll)

[DataContractAttribute(Name = "RelayClientAuthenticationType", Namespace = "http://schemas.microsoft.com/netservices/2009/05/servicebus/connect")]
public enum RelayClientAuthenticationType

Nombre del miembroDescripción
NoneSi lo especifica un agente de escucha, el cliente no tendrá que proporcionar un token de seguridad. Esto representa un mecanismo de exclusión voluntaria con el cual los agentes de escucha pueden prescindir de la protección del Control de acceso de Windows Azure en el extremo.
RelayAccessTokenSi lo especifica un agente de escucha, el cliente tiene que proporcionar un token de seguridad.

Windows Azure Service Bus supports only Full Trust code access security.

The Windows Azure Service Bus bindings use a federated security token authorization scheme to guard access to the Windows Azure Service Bus and to the services listening through it.

This value controls whether clients of a service are required to present a security token issued by the Windows Azure Access Control service to the Windows Azure Service Bus service when sending messages. Services (listeners) are always required to authenticate with Windows Azure Access Control and present an authorization token to the Windows Azure Service Bus. However, the client is only required to authenticate with the Windows Azure Service Bus only if the RelayClientAuthenticationType is set to RelayAccessToken. Setting RelayClientAuthenticationType to None waives the requirement of a token. You may wish to opt out of authentication on the client (sender) in the Service Bus leg of the communication if you are providing your own authentication or if you do not need authentication.The default value is RelayClientAuthenticationType.RelayAccessToken.

For more information on setting security parameters when initializing an Windows Azure Service Bus application, see Securing and Authenticating an AppFabric Service Bus Connection and Configuring an AppFabric Service Bus Application.

The following example creates a channel factory and initializes it with a binding that is explicitly configured to use the RelayAccessToken authentication type. This is achieved by calling the parameterized NetTcpRelayBinding constructor NetTcpRelayBinding(EndToEndSecurityMode, RelayClientAuthenticationType) instead of the default constructor. However, note that in this case the default constructor yields the same result since it initializes the authentication type and transport to the same values as the ones explicitly specified in this example. This example is a modified version of the Client project in the Echo sample; it has the binding defined programmatically instead of having it specified in the App.config file.

Console.Write("Your Service Namespace (ex. sb://<ServiceNamespace>.servicebus.windows.net/): ");
string serviceNamespace = Console.ReadLine();
Console.Write("Your Issuer Name: ");
string issuerName = Console.ReadLine();
Console.Write("Your Issuer Secret: ");
string issuerSecret = Console.ReadLine();

// Create the service URI based on the service namespace.
Uri serviceUri = ServiceBusEnvironment.CreateServiceUri("sb", serviceNamespace, "EchoService");

// Create the credentials object for the endpoint.
TransportClientEndpointBehavior sharedSecretServiceBusCredential = new TransportClientEndpointBehavior();
sharedSecretServiceBusCredential.CredentialType = TransportClientCredentialType.SharedSecret;
sharedSecretServiceBusCredential.Credentials.SharedSecret.IssuerName = issuerName;
sharedSecretServiceBusCredential.Credentials.SharedSecret.IssuerSecret = issuerSecret;

// Create the channel factory.
ChannelFactory<IEchoChannel> channelFactory = 
    new ChannelFactory<IEchoChannel>(new NetTcpRelayBinding(EndToEndSecurityMode.Transport, RelayClientAuthenticationType.RelayAccessToken), new EndpointAddress(serviceUri));

// Apply the Service Bus credentials.
channelFactory.Endpoint.Behaviors.Add(sharedSecretServiceBusCredential);

// Create and open the client channel.
IEchoChannel channel = channelFactory.CreateChannel();
channel.Open();

Console.WriteLine("Enter text to echo (or [Enter] to exit):");
string input = Console.ReadLine();
while (input != String.Empty)
{
    try
    {
        Console.WriteLine("Server echoed: {0}", channel.Echo(input));
    }
    catch (Exception e)
    {
        Console.WriteLine("Error: " + e.Message);
    }
    input = Console.ReadLine();
}

channel.Close();
channelFactory.Close();

Adiciones de comunidad

AGREGAR
Mostrar:
© 2014 Microsoft