コード例 #1
0
        private string GetLdapUniqueId(LdapEntry ldapEntry)
        {
            try
            {
                var ldapUniqueIdAttribute = ConfigurationManager.AppSettings["ldap.unique.id"];

                if (ldapUniqueIdAttribute != null)
                {
                    return(ldapUniqueIdAttribute);
                }

                if (!string.IsNullOrEmpty(
                        ldapEntry.GetAttributeValue(LdapConstants.ADSchemaAttributes.OBJECT_SID) as string))
                {
                    ldapUniqueIdAttribute = LdapConstants.ADSchemaAttributes.OBJECT_SID;
                }
                else if (!string.IsNullOrEmpty(
                             ldapEntry.GetAttributeValue(LdapConstants.RfcLDAPAttributes.ENTRY_UUID) as string))
                {
                    ldapUniqueIdAttribute = LdapConstants.RfcLDAPAttributes.ENTRY_UUID;
                }
                else if (!string.IsNullOrEmpty(
                             ldapEntry.GetAttributeValue(LdapConstants.RfcLDAPAttributes.NS_UNIQUE_ID) as string))
                {
                    ldapUniqueIdAttribute = LdapConstants.RfcLDAPAttributes.NS_UNIQUE_ID;
                }
                else if (!string.IsNullOrEmpty(
                             ldapEntry.GetAttributeValue(LdapConstants.RfcLDAPAttributes.GUID) as string))
                {
                    ldapUniqueIdAttribute = LdapConstants.RfcLDAPAttributes.GUID;
                }

                return(ldapUniqueIdAttribute);
            }
            catch (Exception ex)
            {
                _log.Error("GetLdapUniqueId()", ex);
            }

            return(null);
        }
コード例 #2
0
        /// <summary>
        /// Get property object
        /// </summary>
        /// <param name="propertyName">property name</param>
        /// <returns>value object</returns>
        public object InvokeGet(string propertyName)
        {
            if (_directoryEntry == null)
            {
                return(_ldapEntry.GetAttributeValue(propertyName));
            }

            using (HostingEnvironment.Impersonate())
            {
                return(_directoryEntry.InvokeGet(propertyName));
            }
        }
コード例 #3
0
 /// <summary>
 /// Get property object
 /// </summary>
 /// <param name="propertyName">property name</param>
 /// <returns>value object</returns>
 public sealed override object GetValue(string propertyName, bool getBytes = false)
 {
     return(_ldapEntry.GetAttributeValue(propertyName, getBytes));
 }
コード例 #4
0
 /// <summary>
 /// Get property object
 /// </summary>
 /// <param name="propertyName">property name</param>
 /// <returns>value object</returns>
 public sealed override object GetValue(string propertyName)
 {
     return(_ldapEntry.GetAttributeValue(propertyName));
 }