내보내기(0) 인쇄
모두 확장
확장 최소화

RelayClientAuthenticationType 열거형

서비스의 클라이언트가 메시지를 보낼 때 Windows Azure 액세스 제어에서 발급한 보안 토큰을 Windows Azure Service Bus에 제공해야 하는지 여부를 설명합니다.

네임스페이스:  Microsoft.ServiceBus
어셈블리:  Microsoft.ServiceBus(Microsoft.ServiceBus.dll)

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

멤버 이름설명
None수신기에 의해 지정된 경우 클라이언트는 보안 토큰을 제공할 필요가 없습니다. 이 옵션은 수신기가 끝점에서 Windows Azure 액세스 제어 보호를 사용하지 않을 수 있는 옵트아웃(opt out) 메커니즘을 나타냅니다.
RelayAccessToken수신기에 의해 지정된 경우 클라이언트는 보안 토큰을 제공해야 합니다.

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();

커뮤니티 추가 항목

추가
Microsoft는 MSDN 웹 사이트에 대한 귀하의 의견을 이해하기 위해 온라인 설문 조사를 진행하고 있습니다. 참여하도록 선택하시면 MSDN 웹 사이트에서 나가실 때 온라인 설문 조사가 표시됩니다.

참여하시겠습니까?
표시:
© 2014 Microsoft