chap-schema.xml revision 8e09dca18a95fc3277e0b349306e75a5831a63d6
e6d40133bc9f858308654afb1262b8b483ec5922Till Mossakowski ! CCPL HEADER START
98890889ffb2e8f6f722b00e265a211f13b5a861Corneliu-Claudiu Prodescu ! This work is licensed under the Creative Commons
41eeec8620877f96835b4d543b6a6b615847d6f2Till Mossakowski ! Attribution-NonCommercial-NoDerivs 3.0 Unported License.
cfbd735270fe52115cef0508d265785efcb99cd7Christian Maeder ! To view a copy of this license, visit
41eeec8620877f96835b4d543b6a6b615847d6f2Till Mossakowski ! http://creativecommons.org/licenses/by-nc-nd/3.0/
41eeec8620877f96835b4d543b6a6b615847d6f2Till Mossakowski ! or send a letter to Creative Commons, 444 Castro Street,
41eeec8620877f96835b4d543b6a6b615847d6f2Till Mossakowski ! Suite 900, Mountain View, California, 94041, USA.
41eeec8620877f96835b4d543b6a6b615847d6f2Till Mossakowski ! You can also obtain a copy of the license at
41eeec8620877f96835b4d543b6a6b615847d6f2Till Mossakowski ! trunk/opendj3/legal-notices/CC-BY-NC-ND.txt.
41eeec8620877f96835b4d543b6a6b615847d6f2Till Mossakowski ! See the License for the specific language governing permissions
41eeec8620877f96835b4d543b6a6b615847d6f2Till Mossakowski ! and limitations under the License.
d5aadb569823a9d41ef761433f27dd00d7e4e147Christian Maeder ! If applicable, add the following below this CCPL HEADER, with the fields
d5aadb569823a9d41ef761433f27dd00d7e4e147Christian Maeder ! enclosed by brackets "[]" replaced with your own identifying information:
d5aadb569823a9d41ef761433f27dd00d7e4e147Christian Maeder ! Portions Copyright [yyyy] [name of copyright owner]
d5aadb569823a9d41ef761433f27dd00d7e4e147Christian Maeder ! CCPL HEADER END
0cbb0121c81f5307eeefe7ffbeeac79ff6c5cdf2Jorina Freya Gerken ! Copyright 2011-2013 ForgeRock AS
55c5e901b5c3466300009135585bc70bd576dcb6Christian Maeder xmlns='http://docbook.org/ns/docbook' version='5.0' xml:lang='en'
54ea981a0503c396c2923a1c06421c6235baf27fChristian Maeder xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
697e63e30aa3c309a1ef1f9357745111f8dfc5a9Christian Maeder xsi:schemaLocation='http://docbook.org/ns/docbook http://docbook.org/xml/5.0/xsd/docbook.xsd'
54ea981a0503c396c2923a1c06421c6235baf27fChristian Maeder xmlns:xinclude='http://www.w3.org/2001/XInclude'>
54ea981a0503c396c2923a1c06421c6235baf27fChristian Maeder <indexterm><primary>Schema</primary></indexterm>
4b136ad539bd9f4e115dff4eee4d552a42d4437eChristian Maeder <para>Schema definitions describe the data, and especially the object classes
0cbb0121c81f5307eeefe7ffbeeac79ff6c5cdf2Jorina Freya Gerken and attribute types that can be stored in the directory. By default OpenDJ
0cbb0121c81f5307eeefe7ffbeeac79ff6c5cdf2Jorina Freya Gerken conforms strictly to LDAPv3 standards pertaining to schema definitions and
e49fd57c63845c7806860a9736ad09f6d44dbaedChristian Maeder attribute syntax checking, ensuring that data stored is valid and properly
afe76697dd6888856a066934a1112a38809b27faChristian Maeder formed. Unless your data use only standard schema present in OpenDJ when
58aa0caa9f05787b4bffc2e32d1494cc1766b8cfRazvan Pascanu you install, then you must add additional schema definitions to account
2c81e2bd9f9dee247c74a642c03620a2f799d0a4Razvan Pascanu the data your applications stored.</para>
a5c67efbd82e10368fda4e30d528157066d45c03Christian Maeder <para>Out of the box, OpenDJ comes with many standard schema definitions.
4b136ad539bd9f4e115dff4eee4d552a42d4437eChristian Maeder In addition you can update and extend schema definitions while OpenDJ
4b136ad539bd9f4e115dff4eee4d552a42d4437eChristian Maeder is online. As a result you can add new applications requiring additional
2c81e2bd9f9dee247c74a642c03620a2f799d0a4Razvan Pascanu data without stopping your directory service.</para>
a5c67efbd82e10368fda4e30d528157066d45c03Christian Maeder <para>This chapter demonstrates how to change and to extend OpenDJ schema.
54a0a1e10bd93721cf52dbd9b816c8f108997ec0Christian Maeder This chapter also identifies the standard schema definitions available when
04d04d19fdd5320953c78ad5b6d2d11f85bc4bcfChristian Maeder you install OpenDJ.</para>
da955132262baab309a50fdffe228c9efe68251dCui Jian xlink:href='http://tools.ietf.org/html/rfc4512'>RFC 4512</link>, defines
c458c6f5a2ce173d8af7a7f5cb434813eb870937Jorina Freya Gerken the kinds of information you find in the directory, and can define how
0a5165c161ce13d434b5c0488b533a8de98aafaaChristian Maeder the information are related. This chapter focuses primarily on two types
4b136ad539bd9f4e115dff4eee4d552a42d4437eChristian Maeder of directory schema definitions.</para>
4b136ad539bd9f4e115dff4eee4d552a42d4437eChristian Maeder <itemizedlist>
4b136ad539bd9f4e115dff4eee4d552a42d4437eChristian Maeder <para><firstterm>Attribute type</firstterm> definitions describe attributes
4b136ad539bd9f4e115dff4eee4d552a42d4437eChristian Maeder of directory entries, such as <literal>givenName</literal> or
7ec5cb48d588cc641d27fb2dbeccb6c28856c8daChristian Maeder <para>Here is an example of an attribute type definition.</para>
c458c6f5a2ce173d8af7a7f5cb434813eb870937Jorina Freya Gerken <programlisting language="ldif"># Attribute type definition
fd4856f5eeac6f144f6116002233e5ce4cc8f41bJorina Freya GerkenattributeTypes: ( 0.9.2342.19200300.100.1.3 NAME ( 'mail' 'rfc822Mailbox' )
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder EQUALITY caseIgnoreIA5Match SUBSTR caseIgnoreIA5SubstringsMatch
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} X-ORIGIN 'RFC 4524' )</programlisting>
0a5165c161ce13d434b5c0488b533a8de98aafaaChristian Maeder <para>Attribute type definitions start with an object identifier (OID),
0a5165c161ce13d434b5c0488b533a8de98aafaaChristian Maeder and generally a short name or names that are easier to remember than the
d11391a2447a2005329a95b5d770f24e62bf5b63Christian Maeder OID. The attribute type definition can specify how attribute values
d11391a2447a2005329a95b5d770f24e62bf5b63Christian Maeder should be collated for sorting, and what syntax they use. The X-ORIGIN
0a5165c161ce13d434b5c0488b533a8de98aafaaChristian Maeder is an extension to identify where the definition originated. When you
0a5165c161ce13d434b5c0488b533a8de98aafaaChristian Maeder define your own schema, you likely want to provide an X-ORIGIN to help
d11391a2447a2005329a95b5d770f24e62bf5b63Christian Maeder you to track versions of definitions, and where the definitions came
0a5165c161ce13d434b5c0488b533a8de98aafaaChristian Maeder <para><firstterm>Object class</firstterm> definitions identify the
c458c6f5a2ce173d8af7a7f5cb434813eb870937Jorina Freya Gerken attribute types that an entry must have, and may have. Examples of
54a0a1e10bd93721cf52dbd9b816c8f108997ec0Christian Maeder object classes include <literal>person</literal> and
54a0a1e10bd93721cf52dbd9b816c8f108997ec0Christian Maeder <literal>organizationalUnit</literal>.</para>
54a0a1e10bd93721cf52dbd9b816c8f108997ec0Christian Maeder <para>Here is an example of an object class definition.</para>
54a0a1e10bd93721cf52dbd9b816c8f108997ec0Christian Maeder <programlisting language="ldif"># Object class definition
54a0a1e10bd93721cf52dbd9b816c8f108997ec0Christian MaederobjectClasses: ( 2.5.6.6 NAME 'person' SUP top STRUCTURAL MUST ( sn $ cn )
4b136ad539bd9f4e115dff4eee4d552a42d4437eChristian Maeder MAY ( userPassword $ telephoneNumber $ seeAlso $ description )
afe76697dd6888856a066934a1112a38809b27faChristian Maeder X-ORIGIN 'RFC 4519' )</programlisting>
ce3e8067c8e5c5ffe7e76d75ead46e2b67adcafcChristian Maeder <para>Entries all have an attribute identifying their object classes,
ce3e8067c8e5c5ffe7e76d75ead46e2b67adcafcChristian Maeder called <literal>objectClass</literal>.</para>
ce3e8067c8e5c5ffe7e76d75ead46e2b67adcafcChristian Maeder <para>Object class definitions start with an object identifier (OID), and
ce3e8067c8e5c5ffe7e76d75ead46e2b67adcafcChristian Maeder generally a short name that is easier to remember than the OID. The
ce3e8067c8e5c5ffe7e76d75ead46e2b67adcafcChristian Maeder definition here says that the person object class inherits from the top
fd4856f5eeac6f144f6116002233e5ce4cc8f41bJorina Freya Gerken object class, which is the top-level parent of all object classes. When
afe76697dd6888856a066934a1112a38809b27faChristian Maeder you view the objectclass attribute values on an entry, you see the list
fb88eac77c89b668f5c306173a6fbe2d513e4bccMarkus Gross of object classes that the entry takes. An entry can have one STRUCTURAL
fb88eac77c89b668f5c306173a6fbe2d513e4bccMarkus Gross object class inheritance branch, such as <literal>top</literal> -
ce3e8067c8e5c5ffe7e76d75ead46e2b67adcafcChristian Maeder <literal>person</literal> - <literal>organizationalPerson</literal> -
ce3e8067c8e5c5ffe7e76d75ead46e2b67adcafcChristian Maeder <literal>inetOrgPerson</literal>. Yet entries can have multiple
54a0a1e10bd93721cf52dbd9b816c8f108997ec0Christian Maeder AUXILIARY object classes. The object class then defines the attribute
4b136ad539bd9f4e115dff4eee4d552a42d4437eChristian Maeder types that must be included, and the attribute types that may be included
fd4856f5eeac6f144f6116002233e5ce4cc8f41bJorina Freya Gerken on entries having the object class.</para>
fd4856f5eeac6f144f6116002233e5ce4cc8f41bJorina Freya Gerken <para>An <firstterm>attribute syntax</firstterm> constrains what directory
ce3e8067c8e5c5ffe7e76d75ead46e2b67adcafcChristian Maeder clients can store as attribute values.</para>
afe76697dd6888856a066934a1112a38809b27faChristian Maeder <para>An attribute syntax is identified in an attribute type definition by
afe76697dd6888856a066934a1112a38809b27faChristian Maeder its OID. String-based syntax OIDs are optionally followed by a number, set
4b136ad539bd9f4e115dff4eee4d552a42d4437eChristian Maeder between braces, that represents a minimum upper bound on the number of
0a5165c161ce13d434b5c0488b533a8de98aafaaChristian Maeder characters in the attribute value. For example, in the attribute type
4b136ad539bd9f4e115dff4eee4d552a42d4437eChristian Maeder definition shown above, the syntax is
2c81e2bd9f9dee247c74a642c03620a2f799d0a4Razvan Pascanu <literal>1.3.6.1.4.1.1466.115.121.1.26{256}</literal>. The syntax is an
54a0a1e10bd93721cf52dbd9b816c8f108997ec0Christian Maeder IA5 string (composed of characters from the international version of the
04d04d19fdd5320953c78ad5b6d2d11f85bc4bcfChristian Maeder ASCII character set) that can contain at least 256 characters.</para>
54a0a1e10bd93721cf52dbd9b816c8f108997ec0Christian Maeder <para>You can find a table matching attribute syntax OIDs with their
e49fd57c63845c7806860a9736ad09f6d44dbaedChristian Maeder human-readable names in RFC 4517, <link xlink:show="new"
04d04d19fdd5320953c78ad5b6d2d11f85bc4bcfChristian Maeder xlink:href="http://tools.ietf.org/html/rfc4517#appendix-A">Appendix A.
0cbb0121c81f5307eeefe7ffbeeac79ff6c5cdf2Jorina Freya Gerken Summary of Syntax Object Identifiers</link>. The RFC describes
d5aadb569823a9d41ef761433f27dd00d7e4e147Christian Maeder attribute syntaxes in detail. Alternatively, you can see the attribute
58aa0caa9f05787b4bffc2e32d1494cc1766b8cfRazvan Pascanu syntaxes that OpenDJ supports by opening the OpenDJ Control Panel and
0cbb0121c81f5307eeefe7ffbeeac79ff6c5cdf2Jorina Freya Gerken browsing to Schema > Manage Schema > Attribute Syntaxes. You can
0a5165c161ce13d434b5c0488b533a8de98aafaaChristian Maeder also list them by using the <command>dsconfig</command> command.</para>
afe76697dd6888856a066934a1112a38809b27faChristian Maeder <para>Although attribute syntaxes are often specified in attribute type
0cbb0121c81f5307eeefe7ffbeeac79ff6c5cdf2Jorina Freya Gerken definitions, directory servers do not always check that attribute values
4b136ad539bd9f4e115dff4eee4d552a42d4437eChristian Maeder comply with attribute syntaxes. OpenDJ directory server does tend to
afe76697dd6888856a066934a1112a38809b27faChristian Maeder enforce compliance by default, in particular for certificates, country
4b136ad539bd9f4e115dff4eee4d552a42d4437eChristian Maeder strings, directory strings, JPEG photos, and telephone numbers. The aim
0a5165c161ce13d434b5c0488b533a8de98aafaaChristian Maeder is to avoid accumulating garbage in your directory data.</para>
54a0a1e10bd93721cf52dbd9b816c8f108997ec0Christian Maeder <para>If you are trying unsuccessfully to import non-compliant data from a
54a0a1e10bd93721cf52dbd9b816c8f108997ec0Christian Maeder more lenient directory server, you can either clean the data before
54a0a1e10bd93721cf52dbd9b816c8f108997ec0Christian Maeder importing it, or if cleaning the data is not an option, read <xref
04d04d19fdd5320953c78ad5b6d2d11f85bc4bcfChristian Maeder <para>When creating your own attribute type definitions, use existing
4b136ad539bd9f4e115dff4eee4d552a42d4437eChristian Maeder attribute syntaxes where possible. If you must create your own attribute
0a5165c161ce13d434b5c0488b533a8de98aafaaChristian Maeder syntax, then consider the extensions in
07eb349813c50aff304df13337b5cbc42f48c0a5Jorina Freya Gerken <xref linkend="attr-syntax-schema-definition-extensions" />.</para>
54a0a1e10bd93721cf52dbd9b816c8f108997ec0Christian Maeder <para>Matching rules determine how the directory server compares attribute
0cbb0121c81f5307eeefe7ffbeeac79ff6c5cdf2Jorina Freya Gerken values to assertion values for LDAP search and LDAP compare
0a5165c161ce13d434b5c0488b533a8de98aafaaChristian Maeder operations.</para>
4b136ad539bd9f4e115dff4eee4d552a42d4437eChristian Maeder <para>For example, suppose you search with the filter
0cbb0121c81f5307eeefe7ffbeeac79ff6c5cdf2Jorina Freya Gerken <literal>(uid=bjensen)</literal>. The assertion value in this case is
04d04d19fdd5320953c78ad5b6d2d11f85bc4bcfChristian Maeder <para>OpenDJ has the following schema definition for the user ID
0a5165c161ce13d434b5c0488b533a8de98aafaaChristian Maeder attribute.</para>
0cbb0121c81f5307eeefe7ffbeeac79ff6c5cdf2Jorina Freya Gerken >attributeTypes: ( 0.9.2342.19200300.100.1.1 NAME ( 'uid' 'userid' )
c458c6f5a2ce173d8af7a7f5cb434813eb870937Jorina Freya Gerken EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch
0a5165c161ce13d434b5c0488b533a8de98aafaaChristian Maeder SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} X-ORIGIN 'RFC 4519' )</programlisting>
0a5165c161ce13d434b5c0488b533a8de98aafaaChristian Maeder <para>When finding an equality match for your search, OpenDJ uses the
0a5165c161ce13d434b5c0488b533a8de98aafaaChristian Maeder <literal>caseIgnoreMatch</literal> matching rule to check for user ID
9192fdd8f0e682ac0f0183dd854d5210fbfa4ec5Christian Maeder attribute values that equal <literal>bjensen</literal> without regard
9192fdd8f0e682ac0f0183dd854d5210fbfa4ec5Christian Maeder to case.</para>
0cbb0121c81f5307eeefe7ffbeeac79ff6c5cdf2Jorina Freya Gerken <para>You can see the matching rules that OpenDJ supports by opening the
54a0a1e10bd93721cf52dbd9b816c8f108997ec0Christian Maeder OpenDJ Control Panel and browsing to Schema > Manage Schema >
54a0a1e10bd93721cf52dbd9b816c8f108997ec0Christian Maeder Matching Rules. Notice that many matching rules support string collation
54a0a1e10bd93721cf52dbd9b816c8f108997ec0Christian Maeder in languages other than English. You can also list matching rules by
54a0a1e10bd93721cf52dbd9b816c8f108997ec0Christian Maeder using the <command>dsconfig</command> command.</para>
4b136ad539bd9f4e115dff4eee4d552a42d4437eChristian Maeder <para>As you can read in examples like, <link
07eb349813c50aff304df13337b5cbc42f48c0a5Jorina Freya Gerken xlink:href="admin-guide#extensible-match-search"
07eb349813c50aff304df13337b5cbc42f48c0a5Jorina Freya Gerken xlink:role="http://docbook.org/xlink/role/olink"><citetitle>Search: List
07eb349813c50aff304df13337b5cbc42f48c0a5Jorina Freya Gerken Active Accounts</citetitle></link>, OpenDJ matching rules enable
0a5165c161ce13d434b5c0488b533a8de98aafaaChristian Maeder directory clients to do more interesting searches than simply comparing
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder strings. That example shows how to search for users who have
--filename custom-attr.ldif
--hostname opendj.example.com
--hostname opendj.example.com
--hostname opendj.example.com