How to use the Transformation Engine to correctly Base64 encode the ObjectGUID

Follow
    Applies to:
  • Legacy SecureAuth IdP
Deployment model:
  • On Premises
  • Version Affected:  All

    Description:  

    How to use the Transformation Engine to correctly Base64 encode the ObjectGUID

     

    Cause:  

    The standard B64 example code for the transformation engine does not work correctly on ObjectGUID. Use this method instead. 

     

    Resolution:  

    1. Open the Web Admin console and map an AuxID to ObjectGUID. The example code below assumes that you have mapped AuxID10 to ObjectGuid on the Data tab.

    2. On the Post Auth tab, click the Transformation Engine

    3. Enable the Transformation Engine and use the following code

     

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
    xmlns:user="urn:my-scripts"> 
    <msxsl:script language="C#" implements-prefix="user"> 
    <msxsl:using namespace="System.Globalization"/> 
    <![CDATA[ 
    public string LowerCase(string v) 

    return v.ToLower(); 

    public string UpperCase(string v) 

    return v.ToUpper(); 

    public string CamelWord(string v) 

    TextInfo textinfo = new CultureInfo("en-US",false).TextInfo; 
    return textinfo.ToTitleCase(v); 

    public string b64(string v)
    {
    Guid newGuid = new System.Guid(v);
    Byte[] bytes = newGuid.ToByteArray();
    var encodedGuid = Convert.ToBase64String(bytes);
    return encodedGuid ;

    ]]> 
    </msxsl:script> 
    <xsl:template match="/"> 
    <user> 
    <UserID> 
    <xsl:value-of select="user/UserID" /> 
    </UserID> 
    <Email1> 
    <xsl:value-of select="user/Email1" /> 
    </Email1> 
    <Email2> 
    <xsl:value-of select="user/Email2" /> 
    </Email2> 
    <Email3> 
    <xsl:value-of select="user/Email3" /> 
    </Email3> 
    <Email4> 
    <xsl:value-of select="user/Email4" /> 
    </Email4> 
    <AuxID1> 
    <xsl:value-of select="user/AuxID1"/> 
    </AuxID1> 
    <AuxID2> 
    <xsl:value-of select="user/AuxID2"/> 
    </AuxID2> 
    <AuxID3> 
    <xsl:value-of select="user/AuxID3"/> 
    </AuxID3> 
    <AuxID4> 
    <xsl:value-of select="user/AuxID4"/> 
    </AuxID4> 
    <AuxID5> 
    <xsl:value-of select="user/AuxID5"/> 
    </AuxID5> 
    <AuxID6> 
    <xsl:value-of select="user/AuxID6"/> 
    </AuxID6> 
    <AuxID7> 
    <xsl:value-of select="user/AuxID7"/> 
    </AuxID7> 
    <AuxID8> 
    <xsl:value-of select="user/AuxID8"/> 
    </AuxID8> 
    <AuxID9> 
    <xsl:value-of select="user/AuxID9"/> 
    </AuxID9> 
    <AuxID10> 
    <xsl:value-of select="user:b64(user/AuxID10)"/> 
    </AuxID10> 
    <FirstName> 
    <xsl:value-of select="user/FirstName" /> 
    </FirstName> 
    <LastName> 
    <xsl:value-of select="user/LastName" /> 
    </LastName> 
    <Phone1> 
    <xsl:value-of select="user/Phone1"/> 
    </Phone1> 
    <Phone2> 
    <xsl:value-of select="user/Phone2"/> 
    </Phone2> 
    <Phone3> 
    <xsl:value-of select="user/Phone3"/> 
    </Phone3> 
    <Phone4> 
    <xsl:value-of select="user/Phone4"/> 
    </Phone4> 
    </user> 
    </xsl:template> 
    </xsl:stylesheet>

     

    If implementing this change on multiple servers, note that this does not get synced over via FileSync. You will either need to manually change this on each server or bring over the usersprofiledata.xslt file from the server where this change was implemented.

    This is located in D:\Secureauth\SecureAuthxx\PostAuthData

      

    SecureAuth Knowledge Base Articles provide information based on specific use cases and may not apply to all appliances or configurations. Be advised that these instructions could cause harm to the environment if not followed correctly or if they do not apply to the current use case.

    Customers are responsible for their own due diligence prior to utilizing this information and agree that SecureAuth is not liable for any issues caused by misconfiguration directly or indirectly related to SecureAuth products.

    0 out of 0 found this helpful

    Comments

    0 comments

    Please sign in to leave a comment.