protected bool UpdateConfiguration(bool commitChanges)
        {
            if (ValidatePrerequisite() != ConfigStatus.AllGood)
            {
                return(false);
            }

            if (this.RbIdentityCustomGraphProperty.Checked)
            {
                IdentityCTConfig.DirectoryObjectPropertyToShowAsDisplayText = (AzureADObjectProperty)Convert.ToInt32(this.DDLGraphPropertyToDisplay.SelectedValue);
            }
            else
            {
                IdentityCTConfig.DirectoryObjectPropertyToShowAsDisplayText = AzureADObjectProperty.NotSet;
            }

            AzureADObjectProperty newUserIdentifier = (AzureADObjectProperty)Convert.ToInt32(this.DDLDirectoryPropertyMemberUsers.SelectedValue);

            if (newUserIdentifier != AzureADObjectProperty.NotSet)
            {
                PersistedObject.ClaimTypes.UpdateUserIdentifier(newUserIdentifier);
            }

            AzureADObjectProperty newIdentifierForGuestUsers = (AzureADObjectProperty)Convert.ToInt32(this.DDLDirectoryPropertyGuestUsers.SelectedValue);

            if (newIdentifierForGuestUsers != AzureADObjectProperty.NotSet)
            {
                PersistedObject.ClaimTypes.UpdateIdentifierForGuestUsers(newIdentifierForGuestUsers);
            }

            PersistedObject.AlwaysResolveUserInput          = this.ChkAlwaysResolveUserInput.Checked;
            PersistedObject.FilterExactMatchOnly            = this.ChkFilterExactMatchOnly.Checked;
            PersistedObject.EnableAugmentation              = this.ChkAugmentAADRoles.Checked;
            PersistedObject.FilterSecurityEnabledGroupsOnly = this.ChkFilterSecurityEnabledGroupsOnly.Checked;

            if (commitChanges)
            {
                CommitChanges();
            }
            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// Update the DirectoryObjectPropertyForGuestUsers of the identity ClaimTypeConfig.
        /// </summary>
        /// <param name="newIdentifier">new DirectoryObjectPropertyForGuestUsers</param>
        /// <returns></returns>
        public bool UpdateIdentifierForGuestUsers(AzureADObjectProperty newIdentifier)
        {
            if (newIdentifier == AzureADObjectProperty.NotSet)
            {
                throw new ArgumentNullException("newIdentifier");
            }

            bool identifierUpdated = false;
            IdentityClaimTypeConfig identityClaimType = innerCol.FirstOrDefault(x => x is IdentityClaimTypeConfig) as IdentityClaimTypeConfig;

            if (identityClaimType == null)
            {
                return(identifierUpdated);
            }

            if (identityClaimType.DirectoryObjectPropertyForGuestUsers == newIdentifier)
            {
                return(identifierUpdated);
            }

            identityClaimType.DirectoryObjectPropertyForGuestUsers = newIdentifier;
            identifierUpdated = true;
            return(identifierUpdated);
        }
Beispiel #3
0
        /// <summary>
        /// Update the DirectoryObjectProperty of the identity ClaimTypeConfig. If new value duplicates an existing item, it will be removed from the collection
        /// </summary>
        /// <param name="newIdentifier">new DirectoryObjectProperty</param>
        /// <returns>True if the identity ClaimTypeConfig was successfully updated</returns>
        public bool UpdateUserIdentifier(AzureADObjectProperty newIdentifier)
        {
            if (newIdentifier == AzureADObjectProperty.NotSet)
            {
                throw new ArgumentNullException("newIdentifier");
            }

            bool identifierUpdated = false;
            IdentityClaimTypeConfig identityClaimType = innerCol.FirstOrDefault(x => x is IdentityClaimTypeConfig) as IdentityClaimTypeConfig;

            if (identityClaimType == null)
            {
                return(identifierUpdated);
            }

            if (identityClaimType.DirectoryObjectProperty == newIdentifier)
            {
                return(identifierUpdated);
            }

            // Check if the new DirectoryObjectProperty duplicates an existing item, and delete it if so
            for (int i = 0; i < innerCol.Count; i++)
            {
                ClaimTypeConfig curCT = (ClaimTypeConfig)innerCol[i];
                if (curCT.EntityType == DirectoryObjectType.User &&
                    curCT.DirectoryObjectProperty == newIdentifier)
                {
                    innerCol.RemoveAt(i);
                    break;  // There can be only 1 potential duplicate
                }
            }

            identityClaimType.DirectoryObjectProperty = newIdentifier;
            identifierUpdated = true;
            return(identifierUpdated);
        }
Beispiel #4
0
 public IdentityClaimTypeConfig(ClaimTypeConfig ctConfig)
 {
     this.DirectoryObjectPropertyForGuestUsers = ((IdentityClaimTypeConfig)ctConfig).DirectoryObjectPropertyForGuestUsers;
 }