/// ----------------------------------------------------------------------------- /// <summary> /// AddAuthentication adds a new Authentication System to the Data Store. /// </summary> /// <param name="authSystem">The new Authentication System to add</param> /// <history> /// [cnurse] 07/10/2007 Created /// </history> /// ----------------------------------------------------------------------------- public static int AddAuthentication(AuthenticationInfo authSystem) { EventLogController.Instance.AddLog(authSystem, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.AUTHENTICATION_CREATED); return provider.AddAuthentication(authSystem.PackageID, authSystem.AuthenticationType, authSystem.IsEnabled, authSystem.SettingsControlSrc, authSystem.LoginControlSrc, authSystem.LogoffControlSrc, UserController.Instance.GetCurrentUserInfo().UserID); }
/// ----------------------------------------------------------------------------- /// <summary> /// UpdateAuthentication updates an existing Authentication System in the Data Store. /// </summary> /// <param name="authSystem">The new Authentication System to update</param> /// <history> /// [cnurse] 07/10/2007 Created /// </history> /// ----------------------------------------------------------------------------- public static void UpdateAuthentication(AuthenticationInfo authSystem) { provider.UpdateAuthentication(authSystem.AuthenticationID, authSystem.PackageID, authSystem.AuthenticationType, authSystem.IsEnabled, authSystem.SettingsControlSrc, authSystem.LoginControlSrc, authSystem.LogoffControlSrc, UserController.GetCurrentUserInfo().UserID); var objEventLog = new EventLogController(); objEventLog.AddLog(authSystem, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.AUTHENTICATION_UPDATED); }
public static void DeleteAuthentication(AuthenticationInfo authSystem) { provider.DeleteAuthentication(authSystem.AuthenticationID); var objEventLog = new EventLogController(); objEventLog.AddLog(authSystem, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.AUTHENTICATION_DELETED); }
private void BindLoginControl(AuthenticationLoginBase authLoginControl, AuthenticationInfo authSystem) { //set the control ID to the resource file name ( ie. controlname.ascx = controlname ) //this is necessary for the Localization in PageBase authLoginControl.AuthenticationType = authSystem.AuthenticationType; authLoginControl.ID = Path.GetFileNameWithoutExtension(authSystem.LoginControlSrc) + "_" + authSystem.AuthenticationType; authLoginControl.LocalResourceFile = authLoginControl.TemplateSourceDirectory + "/" + Localization.LocalResourceDirectory + "/" + Path.GetFileNameWithoutExtension(authSystem.LoginControlSrc); authLoginControl.RedirectURL = RedirectURL; authLoginControl.ModuleConfiguration = ModuleConfiguration; //attempt to inject control attributes AddLoginControlAttributes(authLoginControl); authLoginControl.UserAuthenticated += UserAuthenticated; }
/// ----------------------------------------------------------------------------- /// <summary> /// The ReadManifest method reads the manifest file for the Authentication compoent. /// </summary> /// <history> /// [cnurse] 07/25/2007 created /// </history> /// ----------------------------------------------------------------------------- public override void ReadManifest(XPathNavigator manifestNav) { AuthSystem = new AuthenticationInfo(); //Get the type AuthSystem.AuthenticationType = Util.ReadElement(manifestNav, "authenticationService/type", Log, Util.AUTHENTICATION_TypeMissing); //Get the SettingsSrc AuthSystem.SettingsControlSrc = Util.ReadElement(manifestNav, "authenticationService/settingsControlSrc", Log, Util.AUTHENTICATION_SettingsSrcMissing); //Get the LoginSrc AuthSystem.LoginControlSrc = Util.ReadElement(manifestNav, "authenticationService/loginControlSrc", Log, Util.AUTHENTICATION_LoginSrcMissing); //Get the LogoffSrc AuthSystem.LogoffControlSrc = Util.ReadElement(manifestNav, "authenticationService/logoffControlSrc"); if (Log.Valid) { Log.AddInfo(Util.AUTHENTICATION_ReadSuccess); } }
/// ----------------------------------------------------------------------------- /// <summary> /// The Install method installs the authentication component /// </summary> /// <history> /// [cnurse] 07/25/2007 created /// </history> /// ----------------------------------------------------------------------------- public override void Install() { bool bAdd = Null.NullBoolean; try { //Attempt to get the Authentication Service TempAuthSystem = AuthenticationController.GetAuthenticationServiceByType(AuthSystem.AuthenticationType); if (TempAuthSystem == null) { //Enable by default AuthSystem.IsEnabled = true; bAdd = true; } else { AuthSystem.AuthenticationID = TempAuthSystem.AuthenticationID; AuthSystem.IsEnabled = TempAuthSystem.IsEnabled; } AuthSystem.PackageID = Package.PackageID; if (bAdd) { //Add new service AuthenticationController.AddAuthentication(AuthSystem); } else { //Update service AuthenticationController.UpdateAuthentication(AuthSystem); } Completed = true; Log.AddInfo(string.Format(Util.AUTHENTICATION_Registered, AuthSystem.AuthenticationType)); } catch (Exception ex) { Log.AddFailure(ex); } }
/// ----------------------------------------------------------------------------- /// <summary> /// wizNewExtension_NextButtonClick when the next Button is clicked. It provides /// a mechanism for cancelling the page change if certain conditions aren't met. /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 08/25/2008 created /// </history> /// ----------------------------------------------------------------------------- protected void wizNewExtension_NextButtonClick(object sender, WizardNavigationEventArgs e) { switch (e.CurrentStepIndex) { case 0: if (extensionForm.IsValid) { var newPackage = extensionForm.DataSource as PackageInfo; PackageInfo tmpPackage = PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.Name == newPackage.Name); if (tmpPackage == null) { switch (Mode) { case "All": newPackage.PackageType = cboExtensionType.SelectedValue; break; default: newPackage.PackageType = Mode; break; } PackageController.Instance.SaveExtensionPackage(newPackage); Locale locale; LanguagePackInfo languagePack; switch (newPackage.PackageType) { case "Auth_System": //Create a new Auth System var authSystem = new AuthenticationInfo { AuthenticationType = newPackage.Name, IsEnabled = Null.NullBoolean, PackageID = newPackage.PackageID }; AuthenticationController.AddAuthentication(authSystem); break; case "Container": case "Skin": var skinPackage = new SkinPackageInfo { SkinName = newPackage.Name, PackageID = newPackage.PackageID, SkinType = newPackage.PackageType }; SkinController.AddSkinPackage(skinPackage); break; case "CoreLanguagePack": locale = LocaleController.Instance.GetLocale(PortalController.Instance.GetCurrentPortalSettings().DefaultLanguage); languagePack = new LanguagePackInfo { PackageID = newPackage.PackageID, LanguageID = locale.LanguageId, DependentPackageID = -2 }; LanguagePackController.SaveLanguagePack(languagePack); break; case "ExtensionLanguagePack": locale = LocaleController.Instance.GetLocale(PortalController.Instance.GetCurrentPortalSettings().DefaultLanguage); languagePack = new LanguagePackInfo { PackageID = newPackage.PackageID, LanguageID = locale.LanguageId, DependentPackageID = Null.NullInteger }; LanguagePackController.SaveLanguagePack(languagePack); break; case "Module": //Create a new DesktopModule var desktopModule = new DesktopModuleInfo { PackageID = newPackage.PackageID, ModuleName = newPackage.Name, FriendlyName = newPackage.FriendlyName, FolderName = newPackage.Name, Description = newPackage.Description, Version = newPackage.Version.ToString(3), SupportedFeatures = 0 }; int desktopModuleId = DesktopModuleController.SaveDesktopModule(desktopModule, false, true); if (desktopModuleId > Null.NullInteger) { DesktopModuleController.AddDesktopModuleToPortals(desktopModuleId); } break; case "SkinObject": var skinControl = new SkinControlInfo { PackageID = newPackage.PackageID, ControlKey = newPackage.Name }; SkinControlController.SaveSkinControl(skinControl); break; } } else { e.Cancel = true; lblError.Text = string.Format(Localization.GetString("DuplicateName", LocalResourceFile), newPackage.Name); lblError.Visible = true; } } if (PackageEditor != null && PackageID > Null.NullInteger) { BindPackageEditor(); } break; case 1: if (PackageEditor != null) { PackageEditor.UpdatePackage(); } break; case 2: if (ownerForm.IsValid) { PackageController.Instance.SaveExtensionPackage(ownerForm.DataSource as PackageInfo); } Response.Redirect(Globals.NavigateURL(), true); break; } }
public AuthenticationPackageWriter(AuthenticationInfo authSystem, PackageInfo package) : base(package) { AuthSystem = authSystem; Initialize(); }
/// <summary> /// Determines whether the authentication is enabled for the specified portal. /// </summary> /// <param name="authentication">The authentication.</param> /// <param name="portalId">The portal identifier.</param> /// <returns><c>true</c> if OAuth Provider and it is enabled for the portal, Otherwise <c>false</c>.</returns> public static bool IsEnabledForPortal(AuthenticationInfo authentication, int portalId) { return(!string.IsNullOrEmpty(PortalController.GetPortalSetting(authentication.AuthenticationType + "_Enabled", portalId, "")) ? PortalController.GetPortalSettingAsBoolean(authentication.AuthenticationType + "_Enabled", portalId, false) : HostController.Instance.GetBoolean(authentication.AuthenticationType + "_Enabled", false)); }
public static void DeleteAuthentication(AuthenticationInfo authSystem) { provider.DeleteAuthentication(authSystem.AuthenticationID); EventLogController.Instance.AddLog(authSystem, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.AUTHENTICATION_DELETED); }
public static int AddPackage(PackageInfo package, bool includeDetail) { int packageID = provider.AddPackage(package.PortalID, package.Name, package.FriendlyName, package.Description, package.PackageType, package.Version.ToString(3), package.License, package.Manifest, package.Owner, package.Organization, package.Url, package.Email, package.ReleaseNotes, package.IsSystemPackage, UserController.GetCurrentUserInfo().UserID, package.FolderName, package.IconFile); var objEventLog = new EventLogController(); objEventLog.AddLog(package, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.PACKAGE_CREATED); if (includeDetail) { Locale locale; LanguagePackInfo languagePack; switch (package.PackageType) { case "Auth_System": //Create a new Auth System var authSystem = new AuthenticationInfo(); authSystem.AuthenticationType = package.Name; authSystem.IsEnabled = Null.NullBoolean; authSystem.PackageID = packageID; AuthenticationController.AddAuthentication(authSystem); break; case "Container": case "Skin": var skinPackage = new SkinPackageInfo(); skinPackage.SkinName = package.Name; skinPackage.PackageID = packageID; skinPackage.SkinType = package.PackageType; SkinController.AddSkinPackage(skinPackage); break; case "CoreLanguagePack": locale = LocaleController.Instance.GetLocale(PortalController.GetCurrentPortalSettings().DefaultLanguage); languagePack = new LanguagePackInfo(); languagePack.PackageID = packageID; languagePack.LanguageID = locale.LanguageId; languagePack.DependentPackageID = -2; LanguagePackController.SaveLanguagePack(languagePack); break; case "ExtensionLanguagePack": locale = LocaleController.Instance.GetLocale(PortalController.GetCurrentPortalSettings().DefaultLanguage); languagePack = new LanguagePackInfo(); languagePack.PackageID = packageID; languagePack.LanguageID = locale.LanguageId; languagePack.DependentPackageID = Null.NullInteger; LanguagePackController.SaveLanguagePack(languagePack); break; case "Module": //Create a new DesktopModule var desktopModule = new DesktopModuleInfo(); desktopModule.PackageID = packageID; desktopModule.ModuleName = package.Name; desktopModule.FriendlyName = package.FriendlyName; desktopModule.FolderName = package.Name; desktopModule.Description = package.Description; desktopModule.Version = package.Version.ToString(3); desktopModule.SupportedFeatures = 0; int desktopModuleId = DesktopModuleController.SaveDesktopModule(desktopModule, false, true); if (desktopModuleId > Null.NullInteger) { DesktopModuleController.AddDesktopModuleToPortals(desktopModuleId); } break; case "SkinObject": var skinControl = new SkinControlInfo(); skinControl.PackageID = packageID; skinControl.ControlKey = package.Name; SkinControlController.SaveSkinControl(skinControl); break; } } DataCache.ClearPackagesCache(package.PortalID); return packageID; }