Exemple #1
0
        /// <summary>
        /// Find by identity
        /// </summary>
        /// <param name="identityType">An IdentityType enumeration value that specifies the format of the identityValue parameter.</param>
        /// <param name="identityValue">The identity of the principal. This parameter can be any format that is contained in the IdentityType enumeration.</param>
        /// <returns></returns>
        public T FindByIdentity(IdentityType identityType, string identityValue)
        {
            if (string.IsNullOrEmpty(identityValue))
            {
                throw new ArgumentNullException(nameof(identityValue), "Identity value cannot be empty!");
            }

            return(LdapHelper.FindByIdentity <T>(Context, identityType, identityValue));
        }
Exemple #2
0
        public bool IsMemberOf(IdentityType identityType, string identityValue, IdentityType groupIdentityType, string groupIdentityValue)
        {
            var principal = FindByIdentity(identityType, identityValue);

            return(principal.IsMemberOf(LdapHelper.FindByIdentity <GroupPrincipal>(Context, groupIdentityType, groupIdentityValue)));
        }