示例#1
0
        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);
        }
示例#2
0
        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));
        }
示例#3
0
        public MessagingFactory CreateMessagingFactory(bool useCachedFactory)
        {
            this.Validate();
            string            item = this.connectionProperties["OperationTimeout"];
            IEnumerable <Uri> endpointAddresses = this.GetEndpointAddresses();
            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();
            string            str4            = this.connectionProperties["TransportType"];

            if (!useCachedFactory)
            {
                return(this.CreateFactory(endpointAddresses, uris, item, str, item1, str1, item2, str2, item3, windowsPassword, str3, item4, oAuthPassword, str4));
            }
            return(this.GetOrUpdateFactory(endpointAddresses, uris, item, str, item1, str1, item2, str2, item3, windowsPassword, str3, item4, oAuthPassword, str4));
        }
示例#4
0
 internal IList <Uri> GetEndpointAddresses()
 {
     return(KeyValueConfigurationManager.GetEndpointAddresses(this.connectionProperties["Endpoint"], this.connectionProperties["RuntimePort"]));
 }