Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
XML
XML
<!-- Convert objectSid and objectGUID to uniqueID -->

<ScriptletAttributeDefinition id="urn:mace:switch.ch:attribute-def:swissEduPersonUniqueID">
   <DataConnectorDependency requires="directory"/>
   <Scriptlet><![CDATA[

// Import Apache commons codes
import javap(org.apache.commons.codec.digest.DigestUtils);

// Get attributes
Attributes attributes = dependencies.getConnectorResolution("directory");

// Get objectSid
StringAttribute objectSidobsid =  attributes.get("objectSid").toString(;
Attribute obguid =  attributes.get("objectGUID");


// Generate md5 hex of objectSid
String objectSid_encuniqueValue = org.apache.commons.codec.digest.(String)obguid.get(0) + (String)obsid.get(0);

//System.out.println("Unique value: " + uniqueValue );
String localpart = DigestUtils.md5Hex(objectSiduniqueValue);


// Add attribute
//System.out.println("UniqueID: " + localpart + "@switch.ch");
resolverAttribute.addValue( objectSid_enclocalpart + "@switch.ch");


      ]]>
   </Scriptlet>
</ScriptletAttributeDefinition>

...