protected void Page_Load(object sender, EventArgs e) { if (CoreContext.Configuration.Standalone || !SetupInfo.IsVisibleSettings(ManagementType.SingleSignOnSettings.ToString())) { Response.Redirect(CommonLinkUtility.GetDefault(), true); return; } AjaxPro.Utility.RegisterTypeForAjax(typeof(SingleSignOnSettings), Page); Page.RegisterBodyScripts( "~/js/uploader/jquery.fileupload.js", "~/UserControls/Management/SingleSignOnSettings/js/singlesignonsettings.js" ); try { Settings = SsoSettingsV2.Load(); DefaultSettings = new SsoSettingsV2().GetDefault() as SsoSettingsV2; Constants = new { SsoNameIdFormatType = new SsoNameIdFormatType(), SsoBindingType = new SsoBindingType(), SsoSigningAlgorithmType = new SsoSigningAlgorithmType(), SsoEncryptAlgorithmType = new SsoEncryptAlgorithmType(), SsoSpCertificateActionType = new SsoSpCertificateActionType(), SsoIdpCertificateActionType = new SsoIdpCertificateActionType() }; Metadata = new SsoMetadata(); isSsoPost = (Settings.IdpSettings.SsoBinding == "" || Settings.IdpSettings.SsoBinding == SsoBindingType.Saml20HttpPost); isSsoRedirect = Settings.IdpSettings.SsoBinding == SsoBindingType.Saml20HttpRedirect; isSloPost = (Settings.IdpSettings.SloBinding == "" || Settings.IdpSettings.SloBinding == SsoBindingType.Saml20HttpPost); isSloRedirect = (Settings.IdpSettings.SloBinding == SsoBindingType.Saml20HttpRedirect); } catch (Exception ex) { ErrorMessage = ex.Message; } ssoSpCertificatePopupContainer.Options.IsPopup = true; ssoIdpCertificatePopupContainer.Options.IsPopup = true; ssoSettingsInviteContainer.Options.IsPopup = true; ssoSettingsTurnOffContainer.Options.IsPopup = true; HelpLink = CommonLinkUtility.GetHelpLink(); var script = string.Format("SsoSettings.init({0},{1},{2},{3},{4})", JsonConvert.SerializeObject(Settings), JsonConvert.SerializeObject(DefaultSettings), JsonConvert.SerializeObject(Constants), JsonConvert.SerializeObject(Metadata), JsonConvert.SerializeObject(ErrorMessage)); if (isAvailable) { Page.RegisterInlineScript(script); } }
protected void Page_Load(object sender, EventArgs e) { if (CoreContext.Configuration.Standalone || !SetupInfo.IsVisibleSettings(ManagementType.SingleSignOnSettings.ToString())) { Response.Redirect(CommonLinkUtility.GetDefault(), true); return; } AjaxPro.Utility.RegisterTypeForAjax(typeof(SingleSignOnSettings), Page); Page.RegisterBodyScripts("~/UserControls/Management/SingleSignOnSettings/js/singlesignonsettings.js"); Settings = SsoSettingsV2.Load(); HelpLink = CommonLinkUtility.GetHelpLink(); }
protected string RenderEncryptAlgorithmTypeSelector(string id, SsoSettingsV2 settings) { var sb = new StringBuilder(); var currentAlgorithm = id == "ssoEncryptAlgorithm" ? settings.SpCertificateAdvanced.EncryptAlgorithm : settings.SpCertificateAdvanced.DecryptAlgorithm; sb.AppendFormat("<select id=\"" + id + "\" class=\"comboBox\" data-default=\"{0}\"" + (settings.EnableSso ? "" : "disabled") + ">", currentAlgorithm); var fields = typeof(SsoEncryptAlgorithmType).GetFields(); foreach (var field in fields) { var value = field.GetValue(typeof(SsoEncryptAlgorithmType)); var name = value.ToString().Split('#')[1]; sb.AppendFormat("<option " + (String.Equals(currentAlgorithm, value) ? "selected" : "") + " value=\"{0}\">{1}</option>", value, name); } sb.Append("</select>"); return(sb.ToString()); }
protected string RenderSsoNameIdFormatSelector(bool enableSso, SsoSettingsV2 settings) { var sb = new StringBuilder(); var currentNameIdFormat = settings.IdpSettings.NameIdFormat; sb.AppendFormat("<select id=\"ssoNameIdFormat\" class=\"comboBox\" data-default=\"{0}\"" + (enableSso ? "" : "disabled") + ">", currentNameIdFormat); var fields = typeof(SsoNameIdFormatType).GetFields(); var instance = new SsoNameIdFormatType(); foreach (var field in fields) { var value = field.GetValue(instance); sb.AppendFormat("<option " + (String.Equals(currentNameIdFormat, value) ? "selected" : "") + " value=\"{0}\">{1}</option>", value, value); } sb.Append("</select>"); return(sb.ToString()); }