Attribute Mappings

An attribute in an entry is defined as follows:

<mapping>

  <entry ...>

    <at name="..." rdn="...">
      <constant>...</constant>
    </at>

    <at name="..." rdn="...">
      <variable>...</constant>
    </at>

    <at name="..." rdn="...">
      <expression>...</expression>
    </at>

  </entry>

</mapping>
</at>

Attribute Name

The "name" contains the attribute name, e.g. cn, ou. Penrose currently does not validate the attribute names nor the values against the schema.

Attribute Value

There are 3 types of attribute values:

  • constant
  • variable
  • expression

Constant

An attribute may have a constant value. To define a constant attribute:

<at name="o">
  <constant>Example, Inc.</constant>
</at>

Variable

An attribute may get its values from a field in the data source. All fields can be referred to as a variable in this format: sourceName.fieldName.

<mapping>
  <entry ...>
    ...
    <at name="description">
      <variable>group.description</variable>
    </at>
    <source name="group">
      ...
    </source>
  </entry>
</mapping>

Expression

An attribute can get its values from a BeanShell script/expression.

<mapping>
  <entry ...>
    ...
    <at name="cn">
      <expression>
if (user == void || user == null) return null;
return user.firstName+" "+user.lastName;
      </expression>
    </at>
  </entry>
</mapping>

Note that with expressions you need to check for void or null values to prevent errors during execution.

RDN

If the attribute is used as RDN, you need to set rdn="true". Otherwise, by default the rdn is false.

In static entries:

<mapping>
  <entry dn="dc=Example,dc=com">
    ...
    <at name="dc" rdn="true">
      <constant>Example</constant>
    </at>
  </entry>
</mapping>

In dynamic entries:

<mapping>
  <entry dn="cn=...,ou=Groups,dc=Example,dc=com">
    ...
    <at name="cn" rdn="true">
      <variable>group.groupname</variable>
    </at>
    ...
  </entry>
</mapping>