/// <summary> /// Builds the audience of the connection for use in the signature. /// </summary> /// /// <param name="transportType">The type of protocol and transport that will be used for communicating with the Service Bus service.</param> /// <param name="fullyQualifiedNamespace">The fully qualified Service Bus namespace. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> /// <param name="entityName">The name of the specific entity to connect the client to.</param> /// /// <returns>The value to use as the audience of the signature.</returns> /// internal static string BuildConnectionResource( ServiceBusTransportType transportType, string fullyQualifiedNamespace, string entityName) { // If there is no namespace, there is no basis for a URL and the // resource is empty. if (string.IsNullOrEmpty(fullyQualifiedNamespace)) { return(string.Empty); } var builder = new UriBuilder(fullyQualifiedNamespace) { Scheme = transportType.GetUriScheme(), Path = entityName, Port = -1, Fragment = string.Empty, Password = string.Empty, UserName = string.Empty, }; if (builder.Path.EndsWith("/", StringComparison.Ordinal)) { builder.Path = builder.Path.TrimEnd('/'); } return(builder.Uri.AbsoluteUri.ToLowerInvariant()); }
/// <summary> /// Builds the audience for use in the signature. /// </summary> /// /// <param name="transportType">The type of protocol and transport that will be used for communicating with the Service Bus service.</param> /// <param name="fullyQualifiedNamespace">The fully qualified Service Bus namespace. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param> /// <param name="entityName">The name of the specific entity to connect the client to.</param> /// /// <returns>The value to use as the audience of the signature.</returns> /// private static string BuildAudienceResource(ServiceBusTransportType transportType, string fullyQualifiedNamespace, string entityName) { var builder = new UriBuilder(fullyQualifiedNamespace) { Scheme = transportType.GetUriScheme(), Path = entityName, Port = -1, Fragment = string.Empty, Password = string.Empty, UserName = string.Empty, }; if (builder.Path.EndsWith("/")) { builder.Path = builder.Path.TrimEnd('/'); } return(builder.Uri.AbsoluteUri.ToLowerInvariant()); }