public string[] GetKeys(string appName)
 {
     string[] result;
     try
     {
         SSOPropertyBag  sSOPropertyBag  = new SSOPropertyBag();
         ISSOConfigStore iSSOConfigStore = (ISSOConfigStore) new SSOConfigStore();
         iSSOConfigStore.GetConfigInfo(appName, SSO.CONFIG_NAME, 4, sSOPropertyBag);
         string[] array = new string[sSOPropertyBag._dictionary.Count];
         int      num   = 0;
         foreach (KeyValuePair <string, object> current in sSOPropertyBag._dictionary)
         {
             array[num] = current.Key.ToString();
             num++;
         }
         result = array;
     }
     catch (Exception ex)
     {
         EventLog.WriteEntry("SSOConfigCmdTool - GetKeys", ex.Message);
         result = new string[]
         {
             "ERROR: " + ex.Message
         };
     }
     return(result);
 }
Exemple #2
0
 public string[] GetValues(string appName)
 {
     string[] result;
     try
     {
         SSOPropertyBag  sSOPropertyBag  = new SSOPropertyBag();
         ISSOConfigStore iSSOConfigStore = (ISSOConfigStore) new SSOConfigStore();
         iSSOConfigStore.GetConfigInfo(appName, SSO.CONFIG_NAME, 4, sSOPropertyBag);
         string[] array = new string[sSOPropertyBag.Dictionary.Count];
         int      num   = 0;
         foreach (KeyValuePair <string, object> current in sSOPropertyBag.Dictionary)
         {
             array[num] = current.Value.ToString();
             num++;
         }
         result = array;
     }
     catch (Exception ex)
     {
         DoSsoEvent("SSO Helper - GetValues", ex.Message, true);
         result = new string[]
         {
             ""
         };
     }
     return(result);
 }
Exemple #3
0
        /// <summary>
        /// Retrieve dictionary of field/value pairs
        /// </summary>
        /// <param name="appName"></param>
        /// <param name="description"></param>
        /// <param name="contactInfo"></param>
        /// <param name="appUserAcct"></param>
        /// <param name="appAdminAcct"></param>
        /// <returns></returns>
        public static HybridDictionary GetConfigProperties(string appName, out string description, out string contactInfo, out string appUserAcct, out string appAdminAcct)
        {
            int flags;
            int count;

            //get config info
            ISSOAdmin ssoAdmin = new ISSOAdmin();

            ssoAdmin.GetApplicationInfo(appName, out description, out contactInfo, out appUserAcct, out appAdminAcct, out flags, out count);

            //get properties
            ISSOConfigStore configStore   = new ISSOConfigStore();
            SSOPropBag      propertiesBag = new SSOPropBag();

            try
            {
                configStore.GetConfigInfo(appName, idenifierGUID, SSOFlag.SSO_FLAG_RUNTIME, propertiesBag);
            }
            catch (COMException e)
            {
                if (!e.Message.StartsWith("The application is currently disabled."))
                {
                    throw;
                }
            }

            return(propertiesBag.properties);
        }
 /// <summary>
 /// Reloads the Config Store with fresh values from the Enterprise Single Sign-On (SSO).
 /// </summary>
 internal void Reload()
 {
     try
     {
         // reload does not need to provision the dictionary with the names of all the properties but only to populate it with fresh values
         var configStore = new ISSOConfigStore();
         configStore.GetConfigInfo(_affiliateApplicationName, _identifier, SSOFlag.SSO_FLAG_RUNTIME, this);
     }
     catch (COMException exception) when((uint)exception.ErrorCode == (uint)HResult.ErrorMappingNonExistent)
     {
     }
 }
Exemple #5
0
        public static HybridDictionary GetConfigProperties(string appName, out string description, out string contactInfo, out string appUserAcct, out string appAdminAcct)
        {
            int flags;
            int numFields;

            ((ISSOAdmin) new SSOAdmin()).GetApplicationInfo(appName, out description, out contactInfo, out appUserAcct, out appAdminAcct, out flags, out numFields);
            ISSOConfigStore ssoConfigStore = (ISSOConfigStore) new SSOConfigStore();
            SSOPropBag      ssoPropBag     = new SSOPropBag();

            ssoConfigStore.GetConfigInfo(appName, SSOConfigManager.idenifierGUID, 4, (IPropertyBag)ssoPropBag);
            return(ssoPropBag.properties);
        }
        /// <summary>
        /// Retrieves the specified application fields from the SSO store.
        /// </summary>
        /// <param name="appName">The name of the application to retrieve.</param>
        /// <returns>The instance of the SSOAppFieldCollection.</returns>
        public static SSOAppFieldCollection GetApplicationFields(string appName)
        {
            SSOAppFieldCollection appFields   = new SSOAppFieldCollection();
            ISSOConfigStore       configStore = new ISSOConfigStore();

            configStore.GetConfigInfo(appName, SSOManager.ConfigIdentifier, SSOFlag.SSO_FLAG_RUNTIME, appFields);
            foreach (SSOAppField field in appFields)
            {
                field.Identifier = SSOManager.ConfigIdentifier;
            }
            return(appFields);
        }
Exemple #7
0
        internal static string GetConfigInfo(string affiliateApplication, bool enableRemoteAccess)
        {
            int ssoFlag = (enableRemoteAccess ? SSOFlag.SSO_FLAG_NONE : SSOFlag.SSO_FLAG_RUNTIME);

            object         propertyValue;
            SSOPropertyBag bag = new SSOPropertyBag();

            ISSOConfigStore ssoConfigStore = new ISSOConfigStore();

            ssoConfigStore.GetConfigInfo(affiliateApplication, InfoIdentifier, ssoFlag, bag);

            bag.Read(PropName, out propertyValue, 0);

            return((string)propertyValue);
        }
 /// <summary>
 /// Reloads the Config Store with fresh values from the Enterprise Single Sign-On (SSO).
 /// </summary>
 internal void Reload()
 {
     try
     {
         // reload dot not need to provision the dictionary with the names of all the properties but only to populate it with fresh values
         var configStore = new ISSOConfigStore();
         configStore.GetConfigInfo(_affiliateApplicationName, _identifier, SSOFlag.SSO_FLAG_RUNTIME, this);
     }
     catch (COMException exception)
     {
         // Error Code = 'The mapping does not exist. For Config Store applications, the config info has not been set.'
         if ((uint)exception.ErrorCode != 0xC0002A05)
         {
             throw;
         }
     }
 }
 /// <summary>
 /// Loads the Config Store from the Enterprise Single Sign-On (SSO).
 /// </summary>
 internal void Load()
 {
     try
     {
         // provision the dictionary with the names of all the properties that are defined at the affiliate application level
         var mapper = new ISSOMapper2();
         mapper.GetFieldInfo(_affiliateApplicationName, out var labels, out _);
         // skip contact, which is a dummy 1st field
         labels.Where(l => l != AffiliateApplication.DEFAULT_CONTACT_INFO).ForEach(l => Properties.Add(l, default));
         // populate dictionary with all the property values that have been set
         var configStore = new ISSOConfigStore();
         configStore.GetConfigInfo(_affiliateApplicationName, _identifier, SSOFlag.SSO_FLAG_RUNTIME, this);
     }
     catch (COMException exception) when((uint)exception.ErrorCode == (uint)HResult.ErrorMappingNonExistent)
     {
     }
 }
        /// <summary>
        /// Retrieve dictionary of field/value pairs
        /// </summary>
        /// <param name="appName"></param>
        /// <param name="description"></param>
        /// <param name="contactInfo"></param>
        /// <param name="appUserAcct"></param>
        /// <param name="appAdminAcct"></param>
        /// <returns></returns>
        private static HybridDictionary GetConfigProperties(string appName, out string description, out string contactInfo, out string appUserAcct, out string appAdminAcct)
        {
            int flags;
            int count;

            //get config info
            ISSOAdmin ssoAdmin = new ISSOAdmin();

            ssoAdmin.GetApplicationInfo(appName, out description, out contactInfo, out appUserAcct, out appAdminAcct, out flags, out count);

            //get properties
            ISSOConfigStore configStore   = new ISSOConfigStore();
            SsoPropBag      propertiesBag = new SsoPropBag();

            configStore.GetConfigInfo(appName, IdenifierGuid, SSOFlag.SSO_FLAG_RUNTIME, propertiesBag);

            return(propertiesBag.Properties);
        }
Exemple #11
0
        /// <summary>
        /// Loads the settings for the informed BizTalk application.
        /// </summary>
        /// <param name="applicationName">BizTalk application name.</param>
        public void Load(string applicationName)
        {
            // Clear any properties already loaded.
            this.Clear();

            ISSOConfigStore configStore = (ISSOConfigStore) new SSOConfigStore();

            configStore.GetConfigInfo(applicationName, SSOSettingsManager.UID, SSOFlag.SSO_FLAG_RUNTIME, this.PropertyBag);

            object ssoPropertyValue;

            this.PropertyBag.Read(SSOSettingsManager.PropName, out ssoPropertyValue, 0);

            settings ssoSettings = SerializationHelper.Instance.Deserialize <settings>(ssoPropertyValue.ToString());

            // Load the properties dictionary with the settings object.
            foreach (var property in ssoSettings.property)
            {
                this.Settings.Add(property.name, property.Value);
            }
        }
        /// <summary>
        /// Retrieve dictionary of field/value pairs
        /// </summary>
        /// <param name="appName"></param>
        /// <param name="description"></param>
        /// <param name="contactInfo"></param>
        /// <param name="appUserAcct"></param>
        /// <param name="appAdminAcct"></param>
        /// <returns></returns>
        public static HybridDictionary GetConfigProperties(string appName, out string description, out string contactInfo, out string appUserAcct, out string appAdminAcct)
        {
            int flags;
            int count;

            //get config info
            ISSOAdmin ssoAdmin = new ISSOAdmin();
            ssoAdmin.GetApplicationInfo(appName, out description, out contactInfo, out appUserAcct, out appAdminAcct, out flags, out count);

            //get properties
            ISSOConfigStore configStore = new ISSOConfigStore();
            SSOPropBag propertiesBag = new SSOPropBag();

            configStore.GetConfigInfo(appName, idenifierGUID, SSOFlag.SSO_FLAG_RUNTIME, propertiesBag);

            return propertiesBag.properties;
        }
Exemple #13
0
        public string GetAdapterConfig(string appName, string appDescription, Dictionary <string, string> dict)
        {
            string artefactName = string.Empty;

            string applicationName = appName.Replace("{", "");

            applicationName = applicationName.Replace("}", "");

            string[] descriptionParts = appDescription.Split(new string[] { "_" }, StringSplitOptions.None);

            ISSOConfigStore iSSOConfigStore = null;
            DataSet         dataSet         = new DataSet();
            SqlConnection   connection;

            try
            {
                connection = new SqlConnection(string.Format("SERVER={0};DATABASE={1};Integrated Security=SSPI", _registry.BizTalkMgmtDb, _registry.BizTalkMgmtDbName));
                connection.Open();

                ExplorerOM.RootSendHandlerData.Instance.SelectSchema(dataSet, connection);
                ExplorerOM.RootSendPortData.Instance.SelectSchema(dataSet, connection);
                ExplorerOM.RootReceiveHandlerData.Instance.SelectSchema(dataSet, connection);
                ExplorerOM.RootReceiveLocationData.Instance.SelectSchema(dataSet, connection);

                connection.Close();

                // What are we looking for?
                string identifier        = null;
                string transportTypeData = null;
                if (appDescription.Contains("_TH_"))
                {
                    // Transmit handler
                    string    filter = string.Format("uidTransmitLocationSSOAppId = '{0}'", applicationName);
                    DataRow[] rows1  = dataSet.Tables["SendPort"].Select(filter);
                    if (rows1.Length == 0)
                    {
                        if (descriptionParts.Length > 3)
                        {
                            filter = string.Format("uidCustomCfgID = '{0}'", applicationName);
                        }
                        DataRow[] rows = dataSet.Tables["SendHandler"].Select(filter);
                        if (rows.Length > 0)
                        {
                            identifier   = appName;
                            artefactName = string.Format("What: Send handler {0} for host {1}", rows[0][0], rows[0][1]);
                        }
                    }
                    else
                    {
                        identifier   = ((Guid)rows1[0][0]).ToString("B");
                        artefactName = string.Format("What: Send port {0} in application {1}", rows1[0][2], rows1[0][3]);
                    }
                }
                if (appDescription.Contains("_TL_"))
                {
                    // Transmit location
                    string    filter = string.Format("uidTransmitLocationSSOAppId = '{0}'", applicationName);
                    DataRow[] rows1  = dataSet.Tables["SendPort"].Select(filter);
                    if (rows1.Length == 0)
                    {
                        if (descriptionParts.Length > 3)
                        {
                            filter = string.Format("uidCustomCfgID = '{0}'", applicationName);
                        }
                        DataRow[] rows = dataSet.Tables["SendHandler"].Select(filter);
                        if (rows.Length > 0)
                        {
                            identifier   = appName;
                            artefactName = string.Format("What: Send handler {0} for host {1}", rows[0][0], rows[0][1]);
                            //if (descriptionParts.Length <= 3)
                            //{
                            //    identifier = ((Guid)rows[0]["uidCustomCfgID"]).ToString("B");
                            //    //appName = identifier;
                            //}
                        }
                    }
                    else
                    {
                        identifier   = ((Guid)rows1[0][0]).ToString("B");
                        artefactName = string.Format("What: Send port {0} in application {1}", rows1[0][2], rows1[0][3]);
                    }
                }
                if (appDescription.Contains("_RH_"))
                {
                    // Receive handler
                    string    filter = string.Format("uidReceiveLocationSSOAppID = '{0}'", applicationName);
                    DataRow[] rows1  = dataSet.Tables["ReceiveLocation"].Select(filter);
                    if (rows1.Length == 0)
                    {
                        if (descriptionParts.Length > 3)
                        {
                            filter = string.Format("uidCustomCfgID = '{0}'", applicationName);
                        }
                        DataRow[] rows = dataSet.Tables["ReceiveHandler"].Select(filter);
                        if (rows.Length > 0)
                        {
                            identifier   = appName;
                            artefactName = string.Format("What: Receive handler {0} for host {1}", rows[0][0], rows[0][1]);
                        }
                    }
                    else
                    {
                        identifier   = ((Guid)rows1[0][0]).ToString("B");
                        artefactName = string.Format("What: Send port {0} in application {1}", rows1[0][2], rows1[0][3]);
                    }
                }
                if (appDescription.Contains("_RL_"))
                {
                    // Receive location
                    string    filter = string.Format("uidReceiveLocationSSOAppID = '{0}'", applicationName);
                    DataRow[] rows1  = dataSet.Tables["ReceiveLocation"].Select(filter);
                    if (rows1.Length == 0)
                    {
                        if (descriptionParts.Length > 3)
                        {
                            filter = string.Format("uidCustomCfgID = '{0}'", applicationName);
                        }
                        DataRow[] rows = dataSet.Tables["ReceiveHandler"].Select(filter);
                        if (rows.Length > 0)
                        {
                            identifier   = appName;
                            artefactName = string.Format("What: Receive handler {0} for host {1}", rows[0][0], rows[0][1]);
                        }
                    }
                    else
                    {
                        identifier   = ((Guid)rows1[0][0]).ToString("B");
                        artefactName = string.Format("What: Receive location {0} of port {1} in application {2}", rows1[0][2], rows1[0][3], rows1[0][4]);
                    }
                }

                if (null != identifier)
                {
                    AdapterPropertyBag properties = new AdapterPropertyBag(null, "CustomProps");
                    iSSOConfigStore = (new SSOConfigStore() as ISSOConfigStore);
                    iSSOConfigStore.GetConfigInfo(appName.ToUpper(), identifier.ToUpper(), 0, properties);
                    foreach (DictionaryEntry pair in properties.Properties)
                    {
                        dict.Add(pair.Key.ToString(), pair.Value.ToString());
                    }
                }
            }
            catch (Exception exception)
            {
                dict.Add("No entry found", exception.Message);
                //EventLog.WriteEntry("SSO Helper - GetAdapterConfig", exception.Message);
            }
            return(artefactName);
        }