/// <summary> /// Determines whether or not an affiliate application exists. /// </summary> /// <param name="application">The name of the affiliate application to check for existence.</param> public bool Exists(string application) { bool exists = false; string description = ""; string contact = ""; string userGroup = ""; string adminGroup = ""; int flags = 0; int fields = 0; try { ISSOAdmin ssoAdmin = new ISSOAdmin(); ssoAdmin.GetApplicationInfo(application, out description, out contact, out userGroup, out adminGroup, out flags, out fields); exists = true; } catch (Exception e) { if (e.Message.Contains("The application does not exist.")) { exists = false; } else { throw new Exception("Failed to load information for affiliate application " + application + ". " + e.Message); } } return(exists); }
/// <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); }
internal static bool AppExists(string appName) { string description, contact, grpName, grpAdmin; int flags, fields; ISSOAdmin ssoAdmin = new ISSOAdmin(); try { ssoAdmin.GetApplicationInfo(appName, out description, out contact, out grpName, out grpAdmin, out flags, out fields); return(true); } catch { } return(false); }
/// <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); }
/// <summary> /// Finds and returns an <see cref="AffiliateApplication"/> by name in the Enterprise Single Sign-On (SSO) server /// database. /// </summary> /// <param name="name"> /// The name of the <see cref="AffiliateApplication"/> to find in Enterprise Single Sign-On (SSO) server database. /// </param> /// <returns> /// The <see cref="AffiliateApplication"/> currently deployed in the Enterprise Single Sign-On (SSO) server database. /// <c>null</c> if the <see cref="AffiliateApplication"/> does not exist in Enterprise Single Sign-On (SSO) server /// database. /// </returns> public static AffiliateApplication FindByName(string name) { try { var ssoAdmin = new ISSOAdmin(); ssoAdmin.GetApplicationInfo(name, out var description, out var contact, out var userGroupName, out var adminGroupName, out _, out _); return(new AffiliateApplication { Name = name, Contact = contact, Description = description, AdministratorGroup = adminGroupName, UserGroup = userGroupName }); } catch (COMException exception) { if ((uint)exception.ErrorCode == (uint)HResult.ErrorApplicationNonExistent) { return(null); } throw; } }
/// <summary> /// Finds and returns an <see cref="AffiliateApplication"/> by name in the Enterprise Single Sign-On (SSO) server /// database. /// </summary> /// <param name="name"> /// The name of the <see cref="AffiliateApplication"/> to find in Enterprise Single Sign-On (SSO) server database. /// </param> /// <returns> /// The <see cref="AffiliateApplication"/> currently deployed in the Enterprise Single Sign-On (SSO) server database. /// <c>null</c> if the <see cref="AffiliateApplication"/> does not exist in Enterprise Single Sign-On (SSO) server /// database. /// </returns> public static AffiliateApplication FindByName(string name) { try { var ssoAdmin = new ISSOAdmin(); ssoAdmin.GetApplicationInfo(name, out var description, out var contact, out var userGroupName, out var adminGroupName, out _, out _); return(new AffiliateApplication { Name = name, Contact = contact, Description = description, AdministratorGroup = adminGroupName, UserGroup = userGroupName }); } catch (COMException exception) { // Error Code = 'The application does not exist.' // see https://weblog.west-wind.com/posts/2007/Apr/18/C-HRESULT-comparison if ((uint)exception.ErrorCode == 0xC0002A04) { return(null); } throw; } }
/// <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; }