//Save the configuratons to the web.config file of SAML Bridge private void btnSave_Click(object sender, EventArgs e) { SAMLConfigurationManager scm = new SAMLConfigurationManager(); scm.LoadXML(SamlPath); //load the web.config file scm.EnsureParentNodesForSAMLParameters(); //ensure that all the nodes are in place //else create them String LogLevel = cbSetLogLevel.Checked == true ? "debug" : "error"; scm.ModifyNode("/configuration/appSettings", ARTIFACT_CONSUMER, tbArtifactConsumerURL.Text); scm.ModifyNode("/configuration/appSettings", LOG_LEVEL, LogLevel); scm.ModifyNode("/configuration/appSettings", CERT_FRIENDLY_NAME, txtCertName.Text); scm.SaveXML(); //persist the chnages to the web.config file this.Close(); //close the form }
/// <summary> /// Loads the SAML Bridge configuration from web.config to the Form /// </summary> /// <param name="webConfigFilePath">Relative path to SAMl web.config file</param> public void LoadConfigurationFromFileToForm(string webConfigFilePath) { SAMLConfigurationManager scm = new SAMLConfigurationManager(); scm.LoadXML(webConfigFilePath);//load the web.config file //load and set the value of artifact_consumer string myVal = scm.GetNodeValue("/configuration/appSettings/add[@key='" + ARTIFACT_CONSUMER + "']"); if (null == myVal) { myVal = ""; } tbArtifactConsumerURL.Text = myVal; //load and set the value of provider //myVal = scm.GetNodeValue("/configuration/appSettings/add[@key='"+PROVIDER+"']"); //if (null == myVal) //{ // myVal = ""; //} //tbSAMLProvider.Text = myVal; //load and set the value of log level myVal = scm.GetNodeValue("/configuration/appSettings/add[@key='" + LOG_LEVEL + "']"); cbSetLogLevel.Checked = false; if ((null != myVal) && (myVal.ToLower().Equals("debug"))) { cbSetLogLevel.Checked = true; } String certName = scm.GetNodeValue("/configuration/appSettings/add[@key='" + CERT_FRIENDLY_NAME + "']"); if (!String.IsNullOrEmpty(certName)) { txtCertName.Text = certName; } }
/// <summary> /// Loads the SAML Bridge configuration from web.config to the Form /// </summary> /// <param name="webConfigFilePath">Relative path to SAMl web.config file</param> public void LoadConfigurationFromFileToForm(string webConfigFilePath) { SAMLConfigurationManager scm = new SAMLConfigurationManager(); scm.LoadXML(webConfigFilePath);//load the web.config file //load and set the value of artifact_consumer string myVal = scm.GetNodeValue("/configuration/appSettings/add[@key='" + ARTIFACT_CONSUMER + "']"); if (null == myVal) { myVal = ""; } tbArtifactConsumerURL.Text = myVal; //load and set the value of provider //myVal = scm.GetNodeValue("/configuration/appSettings/add[@key='"+PROVIDER+"']"); //if (null == myVal) //{ // myVal = ""; //} //tbSAMLProvider.Text = myVal; //load and set the value of log level myVal = scm.GetNodeValue("/configuration/appSettings/add[@key='"+LOG_LEVEL+"']"); cbSetLogLevel.Checked = false; if ((null != myVal) && (myVal.ToLower().Equals("debug"))) { cbSetLogLevel.Checked = true; } String certName = scm.GetNodeValue("/configuration/appSettings/add[@key='" + CERT_FRIENDLY_NAME + "']"); if (!String.IsNullOrEmpty(certName)) { txtCertName.Text = certName; } }
//Save the configuratons to the web.config file of SAML Bridge private void btnSave_Click(object sender, EventArgs e) { SAMLConfigurationManager scm = new SAMLConfigurationManager(); scm.LoadXML(SamlPath);//load the web.config file scm.EnsureParentNodesForSAMLParameters();//ensure that all the nodes are in place //else create them String LogLevel = cbSetLogLevel.Checked == true ? "debug" : "error"; scm.ModifyNode("/configuration/appSettings", ARTIFACT_CONSUMER, tbArtifactConsumerURL.Text); scm.ModifyNode("/configuration/appSettings", LOG_LEVEL, LogLevel); scm.ModifyNode("/configuration/appSettings", CERT_FRIENDLY_NAME, txtCertName.Text); scm.SaveXML();//persist the chnages to the web.config file this.Close();//close the form }