forgerockopenidm

Decode encoded string while transforming in openidm


I want to decode the string while transforming the data from Active Directory to OpenIDM. Sync between the system is alright but one of the attribute have base64 encoded string.

I want to transform the property before persisting it into managed user object.

Anyone have any idea how can I achieve it. I tried few javascript ways but no success.


Solution

  • Finally I was able to achieve the decoding of the string using below transformation

    if (source != null)
    {
        var base64 = Packages.org.forgerock.util.encode.Base64url
        b64tO = new Packages.java.lang.String(base64.decode(source));
        logger.info("Decoded: {}", b64tO);
        target = b64tO;
    }
    

    Hope it help someone !!!