B2B Integration

 View Only
  • 1.  JWT support for Sterling B2Bi 6.0.X

    InnerCircle
    Posted Thu June 03, 2021 01:44 AM
    Hello All,

    Hope you all are safe and healthy.

    We got a new requirement where in our REST API Calls trigerred frm B2Bi currently we are doing basic auth but now they want us to send basic auth to one endpoint, it will generate JWT token and send us back and then using that JWT token, we need to call the actual endpoint .

    Is this something feasible in Sterling B2Bi 6.0.X or not supported ? We use B2B Integrator and not File gateway.


    ------------------------------
    Pranjit Biswas
    ------------------------------


  • 2.  RE: JWT support for Sterling B2Bi 6.0.X

    Posted Thu June 03, 2021 08:40 AM
    Edited by Girish Venkatesh Thu June 03, 2021 08:40 AM
    Hi Pranjit,

    Hope you doing good too.

    Unfortunately this requirement is not supported in B2Bi 6.0.x  and HTTP Client Adapter allow for only basic authentication.

    Here are few RFE's with same requirement and are marked as Planned for future release.

    https://watsonsupplychain.ideas.aha.io/ideas/B2BI-I-897
    https://watsonsupplychain.ideas.aha.io/ideas/B2BI-I-880

    ------------------------------
    Girish Venkatesh
    ------------------------------



  • 3.  RE: JWT support for Sterling B2Bi 6.0.X

    InnerCircle
    Posted Fri June 04, 2021 05:34 AM
    Hi @Pranjit Biswas,

    I think this will help.
    I have a similiar solution in a production environment.

    <!--
    
    Process-Name:    HTTP_JWT
    
    Description:     HTTP Request with JWT
    
    Created By:      Clayton Snyman 
    
    Changes: 
    ========
    Date       | Owner               | Description 
    ===========|=====================|==============================================================================
    04/06/2021 | Clayton Snyman      | v1.0-00 - Intial version 
    
    Notes: 
    =====
    
    -->
    <process name="HTTP_JWT">
    
        <sequence name="Main">
    
            <!-- Retrieve token 
                Get JWT from a custom properties file or DB.
                Using assign in example.
             -->
            <assign to="JWT/@token" 
                    from="'eyJ0eXBlIjoiSldUIiwiYWxnIjoiUlMyNTYifQ.eyJjdXN0b21lcklkIjoiQ3VzdG9tZXIiLCJleHAiOjE2MjUzODk3NjQsInVzZXJJZCI6IlVzZXIiLCJjdXN0b21lclVzZXJLZXkiOiIwMTIzNDU2Nzg5In0.YyflntcVdHKGH1d_1Hxrcd5AHKuEUmI9IDJ6QFPEaX6bWsuxqbs69C5W7A57ikGQIe3Xq3GeiHGPFivQnt92yM9npIOW_ApsCIcrFtovOLlURXabhhnm-inY5E4xR2_BbY7uF3S1sm3bFK0nL_qEIZwpNGS8vrrihGamBZgwsyakGySMKsqIyyIwAxn6iVHEbqpBrFoTqVgtSWHQ-kShTU-ANrHajw5LrGUMm1cCRPdTny576dO4nmJ8VfKwO8OEXvnjmZavTCiVPbu9SZds9oHqo8oiB_Y_KAFJmG_wEir0XkX3zapGD5DYaI--Ho-0eItTKAdOGGURY_mMC2MVEw'"/>
    
            <!-- DocInfo Service
                Set PrimDoc to required Document Content and Sub-Content type
                Get DocumentId that will be used to build MIME Message
             -->
            <operation name="Set Content Type to json:application">
                <participant name="GetDocumentInfoService"/>
                <output message="xout">
                    <assign to="."                      from="PrimaryDocument"/>
                    <assign to="DocumentContentSubType" from="'json'"/>
                    <assign to="DocumentContentType"    from="'application'"/>
                    <assign to="updateMetaDataOnly"     from="'true'"/>
                </output>
                <input message="xin">
                    <assign to="message/doc:document-id" from="string(DocumentId)" />
                    <assign to="message/@type"           from="string(DocumentContentType)" />
                    <assign to="message/@subType"        from="string(DocumentContentSubType)" />
                </input>
            </operation>
    
            <!-- Assign MIME Message
                Assign HTTP required Header KEY and VALUE 
                    VALUE assigned to mime:message/mime:header
                    KEY assigned to mime:message/mime:header/@name
                Assign doc:document-id to mime:body
            -->
            <operation name="Assign - MIME Header and Body">
                <participant name="AssignService"/>
                <output message="AssignServiceTypeInputMessage">
                    <assign to="mime:message/mime:header"       from="concat('Bearer ',string(JWT/@token))"                       append="true"/>
                    <assign to="mime:message/mime:header/@name" from="string('Authorization')"                                    append="true"/>
                    <assign to="mime:message/mime:header"       from="concat(string(message/@type),'/',string(message/@subType))" append="true"/>
                    <assign to="mime:message/mime:header/@name" from="string('Content-Type')"                                     append="true"/>
                    <assign to="mime:message/mime:body"         from="message/doc:document-id"/>
                </output>
                <input message="inmsg">
                    <assign to="." from="*"/>
                </input>
            </operation>
    
            <operation name="Assign MIME encode document">
                <participant name="MIME"/>
                <output message="packRequest">
                    <assign to="mime-document"   from="mime:message"/>
                </output>
                <input message="packResponse">
                    <assign to="PrimaryDocument" from="mime-document/@*" />
                </input>
            </operation>
            <!-- SAMPLE OUTPUT From Service 
                    This will become the Primary Document used for HTTP Method
                	
                Authorization: Bearer eyJ0eXBlIjoiSldUIiwiYWxnIjoiUlMyNTYifQ.eyJjdXN0b21lcklkIjoiQ3VzdG9tZXIiLCJleHAiOjE2MjUzODk3NjQsInVzZXJJZCI6IlVzZXIiLCJjdXN0b21lclVzZXJLZXkiOiIwMTIzNDU2Nzg5In0.YyflntcVdHKGH1d_1Hxrcd5AHKuEUmI9IDJ6QFPEaX6bWsuxqbs69C5W7A57ikGQIe3Xq3GeiHGPFivQnt92yM9npIOW_ApsCIcrFtovOLlURXabhhnm-inY5E4xR2_BbY7uF3S1sm3bFK0nL_qEIZwpNGS8vrrihGamBZgwsyakGySMKsqIyyIwAxn6iVHEbqpBrFoTqVgtSWHQ-kShTU-ANrHajw5LrGUMm1cCRPdTny576dO4nmJ8VfKwO8OEXvnjmZavTCiVPbu9SZds9oHqo8oiB_Y_KAFJmG_wEir0XkX3zapGD5DYaI\-\-Ho-0eItTKAdOGGURY_mMC2MVEw
                Content-Type: application/json
                Content-Length: 1629
    
                {"json":"data"}
    
             -->
    
            <!-- HTTP process -->
            <operation name="HTTP Session Begin">
                <participant name="HTTPClientBeginSession"/>
                <output message="HTTPClientBeginSessionServiceTypeInputMessage">
                    <assign to="." from="*"/>
                </output>
                <input message="inmsg">
                    <assign to="." from="*"/>
                </input>
            </operation>
    
            <operation name="HTTP Method - POST Mandate">
                <participant name="HTTPClientMethod"/>
                <output message="HTTPClientMethodServiceTypeInputMessage">
                    <assign to="." from="PrimaryDocument"/>
                </output>
                <input message="inmsg">
                    <assign to="." from="*"/>
                </input>
            </operation>
    
            <operation name="HTTP Session End">
                <participant name="HTTPClientEndSession"/>
                <output message="HTTPClientEndSessionServiceTypeInputMessage">
                    <assign to="." from="*"/>
                </output>
                <input message="inmsg">
                    <assign to="." from="*"/>
                </input>
            </operation>
    
            <onFault>
    
                <!-- Handle any errors -->
    
            </onFault>
    
        </sequence>
    
    </process>

    ​Let me know if you have questions or need clarification.

    ------------------------------
    Sincerely,
    Clayton Snyman
    ------------------------------



  • 4.  RE: JWT support for Sterling B2Bi 6.0.X

    Posted Fri June 11, 2021 01:27 PM
    Thank you for sharing !

    ------------------------------
    Kishore Reddy
    ------------------------------



  • 5.  RE: JWT support for Sterling B2Bi 6.0.X

    InnerCircle
    Posted Wed June 16, 2021 02:10 AM
    Thank you Clayton. Appreciate your help here.

    ------------------------------
    Pranjit Biswas
    ------------------------------



  • 6.  RE: JWT support for Sterling B2Bi 6.0.X

    Posted Fri June 04, 2021 09:37 AM
    If B2Bi just need to play the Rest Client role then you can simply use RestAPI Client Service in your business processes to achieve your goal. https://www.ibm.com/docs/en/b2b-integrator/6.0.2?topic=z-rest-api-client-service

    ------------------------------
    BHARAT BALOTHIA
    ------------------------------