Class MCRUserAttributeMapper

java.lang.Object
org.mycore.user2.MCRUserAttributeMapper

public class MCRUserAttributeMapper extends Object
This class is used to map attributes on MCRUser or MCRUserInformation to annotated properties or methods.

You can configure the mapping within realms.xml like this:
 
  <realms local="local">
      ...
      <realm ...>
          ...
          <attributeMapping>
              <attribute name="userName" mapping="eduPersonPrincipalName" />
              <attribute name="realName" mapping="displayName" />
              <attribute name="eMail" mapping="mail" />
              <attribute name="roles" mapping="eduPersonAffiliation" separator="," 
                  converter="org.mycore.user2.utils.MCRRolesConverter">
                  <valueMapping name="employee">editor</valueMapping>
              </attribute>
          </attributeMapping>
          ...
      </realm>
      ...
  </realms>
 
 
Author:
René Adler (eagle)
  • Constructor Details

    • MCRUserAttributeMapper

      public MCRUserAttributeMapper()
  • Method Details

    • instance

      public static MCRUserAttributeMapper instance(Element attributeMapping)
    • mapAttributes

      public boolean mapAttributes(Object object, Map<String,?> attributes) throws Exception
      Maps configured attributes to Object.
      Parameters:
      object - the Object
      attributes - a collection of attributes to map
      Returns:
      true if any attribute was changed
      Throws:
      Exception
    • getAttributeNames

      public Set<String> getAttributeNames()
      Returns a collection of mapped attribute names.
      Returns:
      a collection of mapped attribute names