LDAP Schema的概念跟基本要素
LDAP Schema的概念和基本要素?# GalaxyTitle objectclass( 2.16.840.1.153730.3.4.2NAME GalaxyTitleDES
LDAP Schema的概念和基本要素
?

# GalaxyTitle objectclass( 2.16.840.1.153730.3.4.2 NAME 'GalaxyTitle'DESC 'GalaxyTitle use to manage title' SUP top STRUCTURAL MUST ( uid )MAY ( sortid )) # GalaxyPost objectclass( 2.16.840.1.153730.3.4.32 NAME 'GalaxyPost'DESC 'GalaxyPost use to manage post' SUP top STRUCTURAL MUST ( uid )MAY ( sortid $ type )) # GalaxyDutyobjectclass( 2.16.840.1.153730.3.4.22 NAME 'GalaxyDuty'DESC 'GalaxyDuty use to manage duty' SUP top STRUCTURAL MUST ( dutyuid )MAY ( sortid )) # GalaxyGroup objectclass( 2.16.840.1.153730.3.2.12 NAME 'GalaxyGroup'DESC 'GalaxyGroup use to manage group' SUP top STRUCTURAL MUST ( uid )MAY (sysid $ employeeids $ sortid $ groupType $ searchCondition $ groupManager $ telephone $email $ gfax $ others1 $ others2 $others3 $ uniqueMember $ searchConditionXml)) # GalaxyPeopleobjectclass( 2.16.840.1.153730.3.2.22 NAME 'GalaxyPeople'DESC 'GalaxyPeople use to manage people' SUP InetOrgPerson STRUCTURALMAY (otherDepartmentNumber $ sortid $ ifactivated $ peopleLevel $ leadermember $ leaderFilter $ title $ post $ globalsortid $ virtualaccount )) # GalaxyOrganization objectclass( 2.16.840.1.153730.3.2.2 NAME 'GalaxyOrganization'DESC 'GalaxyOrganization use to manage dep' SUP top STRUCTURAL MUST ( uid )MAY (sysid $ employeeids $ sortid $ depmanager $ telephone $email $ gfax $ others1 $ others2 $others3 $ depmanagerFilter $ title $ post)) # GalaxyContainer objectclass( 2.16.840.1.153730.3.2.16 NAME 'GalaxyContainer'DESC 'a container,can fill with people,org,group...' SUP top STRUCTURAL MUST ( cn ) ) # GalaxyLevel objectclass( 2.16.840.1.153730.3.3.18 NAME 'GalaxyLevel'DESC 'level inof' SUP top STRUCTURAL MUST ( cn $ number ) ) # GalaxyAttOfPeople objectclass( 2.16.840.1.153730.3.3.19 NAME 'GalaxyAttOfPeople'DESC 'att name and sn' SUP top STRUCTURAL MUST ( sn $ cn ) ) ??
??? 2. Attribute
??? attribute就是一个上面objectclass中可能包含的属性,对其的定义包括名称,数据类型,单值还是多值以及匹配规则等。后面用具体的例子来说明。
??? 3. Syntax
??? syntax是LDAP中的“语法”,其实就是LDAP中会用到的数据类型和数据约束,这个语法是遵从X.500中数据约束的定义的。其定义需要有一个ID(遵从X.500)以及说明(DESP)
??? 4. Matching Rules
??? 是用来指定某属性的匹配规则,实际上就是定义一个特殊的Syntax的别名,让LDAP服务器可以识别,并对定义的属性进行匹配。
??? LDAP的schema的主要元素就是这些了,下面列举出了一些LDAP规定好的或是现在比较通用的schema,一般的LDAP服务器都应该可以识别这些定义。
??? 这就是一个名为subschema的objectclass的定义:
??? (2.5.20.1 NAME 'subschema'? AUXILIARY
???? MAY ( dITStructureRules $ nameForms $ ditContentRules $
???????????????? objectClasses $ attributeTypes $ matchingRules $ matchingRuleUse )?)
??? 首先是ID,这里是2.5.20.1,接着是NAME,AUXILIARY说明是辅助型,之后是可选属性的定义,subschema中没有定义必须属性,如果需要定义,应该和MAY一样,将属性放在MUST()中并用$隔开
??
??? 再来看一个属性定义:
??? ( 2.5.4.3 NAME 'cn' SUP name EQUALITY caseIgnoreMatch )
? 可以看到cn属性的父属性是name,它相等性匹配于caseIgnoreMatch(匹配原则为EQUALITY,还有如SUBSTR是字符串匹配,ORDERING是顺序匹配)
??
??? syntax定义一般都比较简单,如:
??? ( 1.3.6.1.4.1.1466.115.121.1.6? DESC? 'String' )
??? 这个定义说明,这一串数字1.3.6.1.4.1.1466.115.121.1.5就代表了LDAP中的字符串,这个数字串的定义和X.500相关,包括了它的存储方式,所占空间大小等。
??? 最后看看Matching Rule的例子,前面提到了caseIgnoreMatch,就看他的吧
? ( 2.5.13.2 NAME 'caseIgnoreMatch'
????? SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )??
??? 其实1.3.6.1.4.1.1466.115.121.1.15 就是LDAP数据类型Directory String的ID,说明前面的cn需要等于这个数据类型才有效。
??? 还有很多常用schema的定义都在了RFC2252中,LDAP服务器都应该支持这些基本的schema。好了,现在基本对LDAP中的schema有个一个大致的说明,可能有不到位或不妥之处,还望大家指正。