private MessagingFactory CreateFactory(IEnumerable <Uri> endpoints, IEnumerable <Uri> stsEndpoints, string operationTimeout, string issuerName, string issuerKey, string sasKeyName, string sasKey, string windowsDomain, string windowsUser, SecureString windowsPassword, string oauthDomain, string oauthUser, SecureString oauthPassword, string transportType) { MessagingFactory messagingFactory; try { MessagingFactorySettings messagingFactorySetting = new MessagingFactorySettings(); if (!string.IsNullOrWhiteSpace(transportType)) { messagingFactorySetting.TransportType = (Microsoft.ServiceBus.Messaging.TransportType)Enum.Parse(typeof(Microsoft.ServiceBus.Messaging.TransportType), transportType); } messagingFactorySetting.TokenProvider = KeyValueConfigurationManager.CreateTokenProvider(stsEndpoints, issuerName, issuerKey, sasKeyName, sasKey, windowsDomain, windowsUser, windowsPassword, oauthDomain, oauthUser, oauthPassword); if (!string.IsNullOrEmpty(operationTimeout)) { messagingFactorySetting.OperationTimeout = TimeSpan.Parse(operationTimeout, CultureInfo.CurrentCulture); } messagingFactory = MessagingFactory.Create(endpoints, messagingFactorySetting); } catch (ArgumentException argumentException1) { ArgumentException argumentException = argumentException1; throw new ConfigurationErrorsException(SRClient.AppSettingsCreateFactoryWithInvalidConnectionString(argumentException.Message), argumentException); } catch (UriFormatException uriFormatException1) { UriFormatException uriFormatException = uriFormatException1; throw new ConfigurationErrorsException(SRClient.AppSettingsCreateFactoryWithInvalidConnectionString(uriFormatException.Message), uriFormatException); } return(messagingFactory); }
public NamespaceManager CreateNamespaceManager() { NamespaceManager namespaceManager; this.Validate(); string item = this.connectionProperties["OperationTimeout"]; IEnumerable <Uri> endpointAddresses = KeyValueConfigurationManager.GetEndpointAddresses(this.connectionProperties["Endpoint"], this.connectionProperties["ManagementPort"]); IEnumerable <Uri> uris = KeyValueConfigurationManager.GetEndpointAddresses(this.connectionProperties["StsEndpoint"], null); string str = this.connectionProperties["SharedSecretIssuer"]; string item1 = this.connectionProperties["SharedSecretValue"]; string str1 = this.connectionProperties["SharedAccessKeyName"]; string item2 = this.connectionProperties["SharedAccessKey"]; string str2 = this.connectionProperties["WindowsDomain"]; string item3 = this.connectionProperties["WindowsUsername"]; SecureString windowsPassword = this.GetWindowsPassword(); string str3 = this.connectionProperties["OAuthDomain"]; string item4 = this.connectionProperties["OAuthUsername"]; SecureString oAuthPassword = this.GetOAuthPassword(); try { TokenProvider tokenProvider = KeyValueConfigurationManager.CreateTokenProvider(uris, str, item1, str1, item2, str2, item3, windowsPassword, str3, item4, oAuthPassword); if (!string.IsNullOrEmpty(item)) { NamespaceManagerSettings namespaceManagerSetting = new NamespaceManagerSettings() { OperationTimeout = TimeSpan.Parse(item, CultureInfo.CurrentCulture), TokenProvider = tokenProvider }; namespaceManager = new NamespaceManager(endpointAddresses, namespaceManagerSetting); } else { namespaceManager = new NamespaceManager(endpointAddresses, tokenProvider); } } catch (ArgumentException argumentException1) { ArgumentException argumentException = argumentException1; throw new ConfigurationErrorsException(SRClient.AppSettingsCreateManagerWithInvalidConnectionString(argumentException.Message), argumentException); } catch (UriFormatException uriFormatException1) { UriFormatException uriFormatException = uriFormatException1; throw new ConfigurationErrorsException(SRClient.AppSettingsCreateManagerWithInvalidConnectionString(uriFormatException.Message), uriFormatException); } return(namespaceManager); }
internal TokenProvider CreateTokenProvider() { IEnumerable <Uri> endpointAddresses = KeyValueConfigurationManager.GetEndpointAddresses(this.connectionProperties["StsEndpoint"], null); string item = this.connectionProperties["SharedSecretIssuer"]; string str = this.connectionProperties["SharedSecretValue"]; string item1 = this.connectionProperties["SharedAccessKeyName"]; string str1 = this.connectionProperties["SharedAccessKey"]; string item2 = this.connectionProperties["WindowsDomain"]; string str2 = this.connectionProperties["WindowsUsername"]; SecureString windowsPassword = this.GetWindowsPassword(); string item3 = this.connectionProperties["OAuthDomain"]; string str3 = this.connectionProperties["OAuthUsername"]; SecureString oAuthPassword = this.GetOAuthPassword(); return(KeyValueConfigurationManager.CreateTokenProvider(endpointAddresses, item, str, item1, str1, item2, str2, windowsPassword, item3, str3, oAuthPassword)); }