예제 #1
0
        public void BaseRefreshRolesInBuilding()
        {
            HeterogeneousCollection rolesValues = BIASettingsReader.BIANetSection?.Authentication?.Roles;

            if (rolesValues != null && rolesValues.Count > 0)
            {
                foreach (IHeterogeneousConfigurationElement heterogeneousElem in rolesValues)
                {
                    if (heterogeneousElem.TagName == "Value")
                    {
                        SetFromKeyElement(rolesInBuilding, heterogeneousElem);
                    }
                    else if (heterogeneousElem.TagName == "ADRole")
                    {
                        ValueElement ADRole = (ValueElement)heterogeneousElem;
                        if (HasRole(ADRole.Key))
                        {
                            rolesInBuilding.Add(ADRole.Key);
                        }
                    }
                    else if (heterogeneousElem is CustomCodeElement)
                    {
                        if (SetFromCustomCodeElement(rolesInBuilding, heterogeneousElem))
                        {
                            CustomCodeRoles(rolesInBuilding);
                        }
                    }
                    else
                    {
                        throw new Exception("Tag " + heterogeneousElem.TagName + " not implemented for Authentication > Role");
                    }
                }
            }
            userInfoContainer.rolesKey = Login;
        }
예제 #2
0
        public void BaseRefreshIdentitiesInBuilding()
        {
            HeterogeneousCollection identities = BIASettingsReader.BIANetSection?.Authentication?.Identities;

            if (identities != null && identities.Count > 0)
            {
                foreach (IHeterogeneousConfigurationElement heterogeneousElem in identities)
                {
                    if (heterogeneousElem is ValueElement)
                    {
                        SetFromValueElement(identitiesInBuilding, heterogeneousElem);
                    }
                    else if (heterogeneousElem is WindowsIdentityElement)
                    {
                        WindowsIdentityElement value = (WindowsIdentityElement)heterogeneousElem;
                        if (Identity != null && Identity.IsAuthenticated && value.IdentityField != null)
                        {
                            identitiesInBuilding.Set(value.Key, PreparePrincipalUserName(Identity, value.IdentityField, value.RemoveDomain), userInfoContainer);
                        }
                    }
                    else if (heterogeneousElem is ObjectFieldElement)
                    {
                        ObjectFieldElement value  = (ObjectFieldElement)heterogeneousElem;
                        object             result = ExtractObjectFieldValue(value);
                        if (result != null)
                        {
                            identitiesInBuilding.Set(value.Key, result.ToString(), userInfoContainer);
                        }
                    }
                    else if (heterogeneousElem.TagName == "CustomCode")
                    {
                        if (SetFromCustomCodeElement(identitiesInBuilding, heterogeneousElem))
                        {
                            CustomCodeIdentities(identitiesInBuilding);
                        }
                    }
                    else if (heterogeneousElem is ClientCertificateInHeaderCollection)
                    {
                    }
                    else
                    {
                        throw new Exception("Tag " + heterogeneousElem.TagName + " not implemented for Authentication > Identities");
                    }
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Refresh the user properties (not overidable)
        /// </summary>
        public void BaseRefreshPropertiesInBuilding()
        {
            HeterogeneousCollection propertiesValues = BIASettingsReader.BIANetSection?.Authentication?.Properties;

            if (propertiesValues != null && propertiesValues.Count > 0)
            {
                foreach (IHeterogeneousConfigurationElement heterogeneousElem in propertiesValues)
                {
                    if (heterogeneousElem is ValueElement)
                    {
                        SetFromValueElement(propertiesInBuilding, heterogeneousElem);
                    }
                    else if (heterogeneousElem is ADFieldElement)
                    {
                        SetFromADFieldElement(propertiesInBuilding, heterogeneousElem);
                    }
                    else if (heterogeneousElem is ObjectFieldElement)
                    {
                        SetFromObjectFieldElement(propertiesInBuilding, heterogeneousElem);
                    }
                    else if (heterogeneousElem is FunctionElement)
                    {
                        SetFromFunctionElement(propertiesInBuilding, heterogeneousElem);
                    }
                    else if (heterogeneousElem is WindowsIdentityElement)
                    {
                        SetFromWindowsIdentityElement(propertiesInBuilding, heterogeneousElem);
                    }
                    else if (heterogeneousElem.TagName == "CustomCode")
                    {
                        if (SetFromCustomCodeElement(propertiesInBuilding, heterogeneousElem))
                        {
                            CustomCodeProperties(propertiesInBuilding);
                        }
                    }
                    else
                    {
                        throw new Exception("Tag " + heterogeneousElem.TagName + " not implemented for Authentication > Properties");
                    }
                }
            }
        }
예제 #4
0
        public void BaseRefreshUserProfileInBuilding()
        {
            //Initialize User profile
            string userProfileKey = "";

            HeterogeneousCollection userProfileValues = BIASettingsReader.BIANetSection?.Authentication?.UserProfile;

            if (userProfileValues != null && userProfileValues.Count > 0)
            {
                foreach (IHeterogeneousConfigurationElement heterogeneousElem in userProfileValues)
                {
                    if (heterogeneousElem is ValueElement)
                    {
                        SetFromValueElement(userProfileInBuilding, heterogeneousElem);
                    }
                    else if (heterogeneousElem is WebServiceElement)
                    {
                        if (!string.IsNullOrEmpty(userProfileKey))
                        {
                            userProfileKey += ",";
                        }
                        userProfileKey += SetFromWebService(userProfileInBuilding, heterogeneousElem);
                    }
                    else if (heterogeneousElem.TagName == "CustomCode")
                    {
                        if (SetFromCustomCodeElement(userProfileInBuilding, heterogeneousElem))
                        {
                            CustomCodeUserProfile(userProfileInBuilding);
                        }
                    }
                    else
                    {
                        throw new Exception("Tag " + heterogeneousElem.TagName + " not implemented for Authentication > UserProfile");
                    }
                }
                userInfoContainer.userProfileKey = userProfileKey;
            }
        }
예제 #5
0
        public void BaseRefreshLanguageInBuilding()
        {
            HeterogeneousCollection languageValues = BIASettingsReader.BIANetSection?.Authentication?.Language;

            if (languageValues != null && languageValues.Count > 0)
            {
                foreach (IHeterogeneousConfigurationElement heterogeneousElem in languageValues)
                {
                    if (heterogeneousElem.TagName == "Value")
                    {
                        ValueElement value = (ValueElement)heterogeneousElem;
                        languageInBuilding = value.Value;
                    }
                    else if (heterogeneousElem.TagName == "Mapping")
                    {
                        MappingCollection mappingCollection = (MappingCollection)heterogeneousElem;
                        if (mappingCollection?.Key != null)
                        {
                            object objectValueToMap = GetObjectValue(this, mappingCollection?.Key);
                            if (objectValueToMap != null)
                            {
                                string sObjectValueToMap = objectValueToMap.ToString();
                                foreach (KeyValueElement mapping in mappingCollection)
                                {
                                    if (mapping.Key == sObjectValueToMap)
                                    {
                                        languageInBuilding = mapping.Value;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    else if (heterogeneousElem.TagName == "CustomCode")
                    {
                        CustomCodeElement customCode = (CustomCodeElement)heterogeneousElem;
                        if (customCode != null)
                        {
                            if (string.IsNullOrEmpty(customCode.Function))
                            {
                                languageInBuilding = CustomCodeLanguage();
                            }
                            else
                            {
                                languageInBuilding = (string)this.GetType().GetMethod(customCode.Function).Invoke(this, null);
                                if (languageInBuilding != null)
                                {
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        throw new Exception("Tag " + heterogeneousElem.TagName + " not implemented for Authentication > Language");
                    }
                    if (languageInBuilding != null)
                    {
                        break;
                    }
                }
            }
            if (languageInBuilding == null)
            {
                languageInBuilding = "en-US";
            }
            userInfoContainer.languageKey = Login;
        }