<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Aditya Singh</title>
    <description>The latest articles on DEV Community by Aditya Singh (@aditya_singh001).</description>
    <link>https://dev.to/aditya_singh001</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2049807%2F8b6c8e04-6e0e-4e6c-b8a2-c26b987e1456.jpg</url>
      <title>DEV Community: Aditya Singh</title>
      <link>https://dev.to/aditya_singh001</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aditya_singh001"/>
    <language>en</language>
    <item>
      <title>Trigger email in DataPower</title>
      <dc:creator>Aditya Singh</dc:creator>
      <pubDate>Mon, 30 Sep 2024 00:44:34 +0000</pubDate>
      <link>https://dev.to/aditya_singh001/triggering-email-in-datapower-using-smtp-server-1p04</link>
      <guid>https://dev.to/aditya_singh001/triggering-email-in-datapower-using-smtp-server-1p04</guid>
      <description>&lt;p&gt;The article is now moved to my website &lt;a href="https://adityasingh-lab.github.io/" rel="noopener noreferrer"&gt;https://adityasingh-lab.github.io/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>datapower</category>
      <category>smtp</category>
      <category>xslt</category>
      <category>ibm</category>
    </item>
    <item>
      <title>Installing IBM API Connect Toolkit on Windows (Designer/UI)</title>
      <dc:creator>Aditya Singh</dc:creator>
      <pubDate>Wed, 25 Sep 2024 16:13:34 +0000</pubDate>
      <link>https://dev.to/aditya_singh001/installing-ibm-api-connect-toolkit-designerui-3j5e</link>
      <guid>https://dev.to/aditya_singh001/installing-ibm-api-connect-toolkit-designerui-3j5e</guid>
      <description>&lt;p&gt;Hello Tech Enthusiast, &lt;/p&gt;

&lt;p&gt;Discussing toolkits, IBM API Connect (hereafter referred as APIC) provides an offline toolkit designed for development purposes, which includes an offline UI, also known as the Designer toolkit, and command-line enabled commands to automate deployment processes (CI/CD).&lt;/p&gt;

&lt;p&gt;We can either download it from &lt;a href="https://www.ibm.com/support/fixcentral/swg/selectFixes?parent=ibm%7EWebSphere&amp;amp;product=ibm/WebSphere/IBM+API+Connect&amp;amp;release=10.0.5.7&amp;amp;platform=All&amp;amp;function=textSearch&amp;amp;text=toolkit" rel="noopener noreferrer"&gt;IBM Fix Central&lt;/a&gt; or best case, use APIC Cloud/Manager UI homepage. Here, I'm using API Manager UI to install.&lt;/p&gt;

&lt;p&gt;I will also provide guidance on automating deployment in upcoming articles. Stay tuned.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;On APIC Manager UI homepage and click 'Download toolkit'. I prefer to set up the credentials in the first step as well, as this allows the designer UI to run immediately after installation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fawx0e1q9z9bl61a7e50s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fawx0e1q9z9bl61a7e50s.png" alt="api-manager homepage" width="800" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fopel1knbhyxeop9tllez.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fopel1knbhyxeop9tllez.png" alt="toolkit-installation options" width="800" height="773"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Download API Designer credentials (designer_credentials.json).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Update environment variable to designer_credentials.json. Run following command from windows CMD (need admin to run). You can do the same from windows gui.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;setx APIC_DESIGNER_CREDENTIALS &amp;lt;folderpath&amp;gt;\designer_credentials.json /m&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo5n9b63ipo3j2vq678ej.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo5n9b63ipo3j2vq678ej.png" alt="Image description" width="800" height="84"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In case permission issue, we can use temporary set instead of setx variable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next, on the step-1 Download toolkit, select the windows operating system. It will download toolkit-loopback-designer-windows.zip file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Extract the content and you can see two files as &lt;strong&gt;api_designer-win.exe&lt;/strong&gt; and &lt;strong&gt;apic.exe&lt;/strong&gt; {command line toolkit}. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Double click the api_designer-win.exe and follow the prompt (Next / Install).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhstmbw6fsnvi2y4dhlg5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhstmbw6fsnvi2y4dhlg5.png" alt="Toolkit Installation" width="790" height="738"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2b0lazd7p6ap0a2v8izc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2b0lazd7p6ap0a2v8izc.png" alt="Toolkit Installation" width="742" height="579"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After installation, it would request to Connect to cloud&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp6osrtvateoqlfx33siw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp6osrtvateoqlfx33siw.png" alt="Designer Toolkit-cloud connection prompt" width="800" height="501"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkxhrxel8xwcvaedk96xr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkxhrxel8xwcvaedk96xr.png" alt="Designer Toolkit-cloud connection prompt" width="800" height="491"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;open the designer and it would ask you to 'Open a Directory'. If this is your first time, create a project directory in your local windows folder and select it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqrj6f0sbhi826kqwl9ch.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqrj6f0sbhi826kqwl9ch.png" alt="Designer Toolkit" width="800" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiq6qonhv0hy1jsomnuba.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiq6qonhv0hy1jsomnuba.png" alt="Toolkit login" width="800" height="498"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flltztpw0km0k4op62iqo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flltztpw0km0k4op62iqo.png" alt="Image description" width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>[Part 3/3] Securing APIs using JSON Web Token (JWT) in IBM API-Connect v10 using X.509 RSA key pair</title>
      <dc:creator>Aditya Singh</dc:creator>
      <pubDate>Wed, 25 Sep 2024 12:21:35 +0000</pubDate>
      <link>https://dev.to/aditya_singh001/part-33-securing-apis-using-json-web-token-jwt-in-ibm-api-connect-v10-using-x509-rsa-key-pair-45po</link>
      <guid>https://dev.to/aditya_singh001/part-33-securing-apis-using-json-web-token-jwt-in-ibm-api-connect-v10-using-x509-rsa-key-pair-45po</guid>
      <description>&lt;p&gt;Hello Tech Enthusiasts,&lt;/p&gt;

&lt;p&gt;Refer previous parts of this series Part 1 and Part 2.&lt;/p&gt;

&lt;p&gt;This is final article of our series focusses on the validation of JWT tokens using the APIC v10 jwt-validate policy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Update API to Validate JWT token
&lt;/h2&gt;

&lt;h4&gt;
  
  
  - Select the API ‘JWT Generation and Validation’ and go to Gateway polices tab.
&lt;/h4&gt;

&lt;h4&gt;
  
  
  - Drag gatewayscript policy to operation-switch case 1.
&lt;/h4&gt;

&lt;h4&gt;
  
  
  - Copy-paste following code
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var jwttoken = context.request.header.get('Authorization');

//remove Bearer from the token
context.set('input-jwt', jwttoken.replace(/^Bearer /g, ''));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  - Drag &lt;code&gt;jwt-validate&lt;/code&gt; and fill the form
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;JSON WebToken (JWT): &lt;code&gt;input-jwt&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Output Claims: &lt;code&gt;decoded.claims&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Issuer Claim: &lt;code&gt;apic&lt;/code&gt;'for more than one claim, enter regrex pattern (PCRE)'&lt;/li&gt;
&lt;li&gt;Audience Claim: &lt;code&gt;id1&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Verify Crypto Object: &lt;code&gt;personal_sandbox_tlsp-jwt-keyprofileV1.0.0-ca-0&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  - Drag ‘set-variable’ and copy the following yaml to source
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                - jwt-validate:
                    version: 2.0.0
                    title: jwt-validate
                    jwt: input-jwt
                    output-claims: decoded.claims
                    iss-claim: apic
                    aud-claim: id1
                    jws-crypto: personal_sandbox_tlsp-jwt-keyprofileV1.0.0-ca-0
                    jwe-crypto: ''
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  - Create Catch policy for error handling
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    catch:
      - errors:
          - RuntimeError
        execute:
          - set-variable:
              version: 2.0.0
              title: set-variable
              actions:
                - set: message.status.code
                  value: 400
                  type: number
                - set: message.status.reason
                  value: Bad Request
                  type: string
                - set: message.body
                  value: $(jwt-validate.error-message)
                  type: string
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  - Save and Publish the API to sandbox catalog
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs3lecej7s8tmu1huy080.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs3lecej7s8tmu1huy080.png" alt="api assembly"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  API file
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;swagger: '2.0'
info:
  title: JWT Generation and Validation
  x-ibm-name: jwt-generation-and-validation
  version: 1.0.0
  description: &amp;gt;
    This API has two parts 

    1. Generate JWT: The generate operation takes care of generating jwt token
    and setting that to response payload Authorization header

    2. 
x-ibm-configuration:
  cors:
    enabled: true
  gateway: datapower-api-gateway
  type: rest
  phase: realized
  enforced: true
  testable: true
  assembly:
    execute:
      - operation-switch:
          version: 2.0.0
          title: operation-switch
          case:
            - operations:
                - verb: get
                  path: /generate
              execute:
                - jwt-generate:
                    version: 2.0.0
                    title: jwt-generate
                    jwt: ''
                    iss-claim: request.headers.iss-claim
                    exp-claim: 60
                    description: //This policy is to generate JWT token for client request.
                    jws-alg: RS256
                    jws-crypto: personal_sandbox_tlsp-jwt-keyprofileV1.0.0-key
                    jti-claim: true
                    aud-claim: request.headers.aud-claim
            - operations:
                - verb: get
                  path: /validate
              execute:
                - gatewayscript:
                    version: 2.0.0
                    title: gatewayscript
                    source: &amp;gt;-
                      var jwttoken =
                      context.request.header.get('Authorization');


                      context.set('input-jwt', jwttoken.replace(/^Bearer /g,
                      ''));
                - jwt-validate:
                    version: 2.0.0
                    title: jwt-validate
                    jwt: input-jwt
                    output-claims: decoded.claims
                    iss-claim: apic
                    aud-claim: id1
                    jws-crypto: personal_sandbox_tlsp-jwt-keyprofileV1.0.0-ca-0
                    jwe-crypto: ''
                - set-variable:
                    version: 2.0.0
                    title: set-variable
                    actions:
                      - set: message.body
                        value: $(decoded.claims)
                        type: string
                      - set: message.headers.Content-Type
                        value: application/json
                        type: string
                    description: &amp;gt;-
                      This policy is setting response body from the extracted
                      jwt verification
          otherwise: []
    catch:
      - errors:
          - RuntimeError
        execute:
          - set-variable:
              version: 2.0.0
              title: set-variable
              actions:
                - set: message.status.code
                  value: 400
                  type: number
                - set: message.status.reason
                  value: Bad Request
                  type: string
                - set: message.body
                  value: $(jwt-validate.error-message)
                  type: string
  properties:
    target-url:
      value: http://example.com/operation-name
      description: The URL of the target service
      encoded: false
  activity-log:
    enabled: true
    success-content: activity
    error-content: payload
basePath: /securetoken
paths:
  /generate:
    get:
      responses:
        '200':
          description: success
          schema:
            type: string
  /validate:
    get:
      responses:
        '200':
          description: success
          schema:
            type: string
securityDefinitions:
  clientID:
    type: apiKey
    in: header
    name: X-IBM-Client-Id
security:
  - clientID: []
schemes:
  - https
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Testing (Success Scenario)
&lt;/h2&gt;

&lt;h4&gt;
  
  
  - Add new GET Request in Postman
&lt;/h4&gt;

&lt;h4&gt;
  
  
  - Add X-IBM-Client-Idin header
&lt;/h4&gt;

&lt;h4&gt;
  
  
  - In Scripts section, copy paste following code to pre-request to GET /validate request:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var jwtToken = pm.globals.get("jwt_token");

pm.request.headers.add({
    key: "Authorization",
    value: jwtToken

}
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  - First trigger GET /generate request first from Postman to fetch JWT in Authorization
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fos2pixe10xqmenxs2c46.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fos2pixe10xqmenxs2c46.png" alt="postman screenshot - fetch jwt token"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  - Now trigger GET /validate request from Postman and verify success 200 Ok with JWT payload details
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo44sm8wvaxe7mmh46js2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo44sm8wvaxe7mmh46js2.png" alt="postman screenshot - successful scenario"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing (Failure Scenario)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Scenario 1: Token is expired
&lt;/h3&gt;

&lt;p&gt;Response received: &lt;br&gt;
&lt;code&gt;JWT validation failed, because the JWT has expired at Sun Sep 08 2024 21:52:31 GMT+0100 (British Summer Time).&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbndr9x98ibt5xr9j8aat.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbndr9x98ibt5xr9j8aat.png" alt="postman screenshot - failure scenario 1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Scenario 2: Token Header is tampered
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzryulwdk4dln90xv6t4v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzryulwdk4dln90xv6t4v.png" alt="postman screenshot - failure scenario 2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Scenario 3: Token payload is tampered
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftcogaxivojo5pf77jkqg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftcogaxivojo5pf77jkqg.png" alt="postman screenshot - failure scenario 3"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Scenario 4: Token signature is tampered
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo4p8gnq7s9srm3jhyx6i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo4p8gnq7s9srm3jhyx6i.png" alt="postman screenshot - failure scenario 4"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>[Part 2/3] Securing APIs using JSON Web Token (JWT) in IBM API-Connect v10 using X.509 RSA key pair</title>
      <dc:creator>Aditya Singh</dc:creator>
      <pubDate>Wed, 25 Sep 2024 07:30:48 +0000</pubDate>
      <link>https://dev.to/aditya_singh001/part-23-securing-apis-using-json-web-token-jwt-in-ibm-api-connect-v10-using-x509-rsa-key-pair-2cfj</link>
      <guid>https://dev.to/aditya_singh001/part-23-securing-apis-using-json-web-token-jwt-in-ibm-api-connect-v10-using-x509-rsa-key-pair-2cfj</guid>
      <description>&lt;p&gt;Hello Tech Enthusiasts,&lt;/p&gt;

&lt;p&gt;Please refer to the previous article, Part 1, to understand how we generate and upload certificates in IBM API Connect.&lt;/p&gt;

&lt;p&gt;This article continues focusses on the generation of JWT tokens using the APIC v10 jwt-generate policy.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Login to APIC Manager console and go to develop tab. Create new API using OpenAPI 2.0. You can use OpenAPI 3.0 as well as jwt-generate policy remains the same.&lt;/li&gt;
&lt;li&gt;Give the Title as ‘JWT Generation and Validation’ and base path ‘/securetoken’. Select next and create the API&lt;/li&gt;
&lt;li&gt;Delete the blank path and create following path with ‘get’ Operations. I’m using get here, but it may vary according to your requirement. For now, I’m keeping it simple.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7mg67k6ucavjrvd6zguc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7mg67k6ucavjrvd6zguc.png" alt="API Manager Design Tab"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the Gateway tab and drag the operation-switch into the assembly section.&lt;/li&gt;
&lt;li&gt;Construct two cases based on the operations as follows&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp5i1ox12dfiygyi7sok2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp5i1ox12dfiygyi7sok2.png" alt="assembly-operation-switch"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For generate part, drag the jwt-generate in the assembly section and fill the forms as following:&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Empty the JSON Web Token as we prefer the response to be sent tin Authorization header.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Issuer Claim&lt;/strong&gt;: &lt;code&gt;request.headers.iss-claim&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Audience Claim&lt;/strong&gt;: &lt;code&gt;request.headers.aud-claim&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Reduce the validity period to &lt;code&gt;60&lt;/code&gt;seconds to facilitate the testing of both successful and failure scenarios easily.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cryptographic Algorithm&lt;/strong&gt;: &lt;code&gt;RS256&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sign Crypto Object&lt;/strong&gt;: &lt;code&gt;personal_sandbox_tlsp-jwt-keyprofileV1.0.0-key&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0fqd76cn99li3ssn2t3m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0fqd76cn99li3ssn2t3m.png" alt="apic-jwt-generate"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click Save and Publish the API.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For simplicity, I’m only using X-IBM-Client-Id as client validation. Let’s generate JWT token now&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fblpwnvvcchxepoog2xdv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fblpwnvvcchxepoog2xdv.png" alt="Postman Generate JWT"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When using Postman, consider automating the token process with JavaScript instead of copying and pasting the token manually.&lt;/p&gt;

&lt;p&gt;Select the Request in Postman and go to Scripts tab. Add following JavaScript to the ‘post-response section’&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let access_token = pm.response.headers.get("Authorization");
pm.globals.set("jwt_token", access_token);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let’s move to now Part 3 of validation of above generated token.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>[Part 1/3] Securing APIs using JSON Web Token (JWT) in IBM API-Connect v10 using X.509 RSA key pair</title>
      <dc:creator>Aditya Singh</dc:creator>
      <pubDate>Wed, 25 Sep 2024 07:21:36 +0000</pubDate>
      <link>https://dev.to/aditya_singh001/part-13-securing-apis-using-json-web-token-jwt-in-ibm-api-connect-v10-using-x509-rsa-key-pair-2b82</link>
      <guid>https://dev.to/aditya_singh001/part-13-securing-apis-using-json-web-token-jwt-in-ibm-api-connect-v10-using-x509-rsa-key-pair-2b82</guid>
      <description>&lt;p&gt;Hello Tech Enthusiasts,&lt;/p&gt;

&lt;p&gt;You’re here to address the challenge of securing your APIs with JWT generation/validation policy in IBM API Connect. This series of articles will concentrate on the widely requested use of X.509 RSA certificates/keys for signing and verification. I’ll tackle this with a straightforward method, and if you have a more complex requirement, leave your comments, and I’ll craft an article for it. In part 1 of this series, we’ll generate a certificate using DataPower cryptographic tools and upload it to the IBM API Connect Manager UI. Parts-2 and Part-3 will focus on JWT generation and validation, respectively.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed. Refer JSON Web Token Introduction — jwt.io.&lt;/p&gt;

&lt;p&gt;Also, do refer &lt;a href="https://www.ibm.com/blog/ibm-named-a-leader-in-the-2023-gartner-magic-quadrant-for-api-management/" rel="noopener noreferrer"&gt;IBM Named a Leader in the 2023 Gartner Magic Quadrant for API Management — IBM Blog&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;IBM API Connect — v10.0.5.x (hereafter referred as APIC)&lt;/li&gt;
&lt;li&gt;IBM DataPower Gateway (API Gateway) — 10.5.0.x. (hereafter referred as DataPower)&lt;/li&gt;
&lt;li&gt;Postman — 11.11.1: For testing JWT generation and validation. Feel free to use any testing tool you prefer.&lt;/li&gt;
&lt;li&gt;Certificate/Key Pair: I’ve utilized DataPower cryptographic tools to generate self-sign certificate, but OpenSSL is also an option. In case you’re using pre-defined certificate, you can ignore the step-1&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Generate Self-Sign Certificate
&lt;/h2&gt;

&lt;p&gt;In BAU world, operation team does uses DataPower Crypto tools on day-to-day basis to generate CSR/key pair for CA signed certificate request other than openssl. Here are quick steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Login to DataPower web console (Prefer New UI as the existing is now deprecated. Something I’ll miss for sure!)&lt;/li&gt;
&lt;li&gt;Search for Crypto tools and fill out Common-Name (keeping other fields empty and rest setting to default). Click Submit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5lm3n9fmj6mqyuespcy4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5lm3n9fmj6mqyuespcy4.png" alt="DataPower Crypto Tools" width="800" height="893"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The certificates are stored in temporary folder. Download the public/private certificate.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgjmfypz4kdrn3y1vc9kd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgjmfypz4kdrn3y1vc9kd.png" alt="Self-Sign Generated Certificate" width="800" height="91"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Upload the Certificate in APIC TLS Profile
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Go to api-manager-ui → Resources → TLS&lt;/li&gt;
&lt;li&gt;Create a new Keystore ‘JWT Keystore’ and upload private and public key&lt;/li&gt;
&lt;li&gt;Create a TLS Client Profile ‘JWT Keyprofile’ and select ‘JWT Keystore’&lt;/li&gt;
&lt;li&gt;Go to Manage → Catalog (I’m using Sandbox as my catalog here) → Catalog setting → TLS client profiles.&lt;/li&gt;
&lt;li&gt;Click Edit and select ‘JWT-Keyprofile’&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The aforementioned step will generate cryptographic certificate and key objects in DataPower (refer to the screenshot below). These will be utilized in the generation and validation of JWTs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The file names are in following format:&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;private-key file&lt;/em&gt;: &amp;lt;apim-organization&amp;gt;_&amp;lt;catalog&amp;gt;_tlsp-&amp;lt;apim-tlsclientprofile&amp;gt;V&amp;lt;version&amp;gt;-key&lt;/p&gt;

&lt;p&gt;&lt;em&gt;public-cert file&lt;/em&gt;: &amp;lt;apim-organization&amp;gt;_&amp;lt;catalog&amp;gt;_tlsp-&amp;lt;apim-tlsclientprofile&amp;gt;V&amp;lt;version&amp;gt;-ca-&amp;lt;sequence number&amp;gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In my case,&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;apim-organization&lt;/em&gt; : personal&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;catalog&lt;/em&gt;: sandbox&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;apim-clientprofile&lt;/em&gt;: jwt-keyprofile (what we created in above steps)&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;version&lt;/em&gt;: 1.0.0 (you can see this from api-manager ui)&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;cert sequence number&lt;/em&gt;: This should 0. The incremental is based on in case you add truststore file as well.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv8e0yqo71gq39pm1c70x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv8e0yqo71gq39pm1c70x.png" alt="Crypto Certificate (Public certificate to be used in JWT validation)&amp;lt;br&amp;gt;
" width="800" height="220"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3akmn7bwnjz0yuqqoams.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3akmn7bwnjz0yuqqoams.png" alt="Crypto Key (Private Certificate in signing JWT)" width="800" height="224"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Decomposed vs. Microservices</title>
      <dc:creator>Aditya Singh</dc:creator>
      <pubDate>Mon, 09 Sep 2024 22:52:42 +0000</pubDate>
      <link>https://dev.to/aditya_singh001/decomposed-vs-microservices-21cl</link>
      <guid>https://dev.to/aditya_singh001/decomposed-vs-microservices-21cl</guid>
      <description>&lt;p&gt;Decomposed and Microservices are related concepts, but they are used in different contexts and have distinct meanings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Decomposed&lt;/strong&gt;&lt;br&gt;
General Meaning: The term “decomposed” refers to breaking down something into smaller, more manageable parts. This can apply to various fields, such as biology, chemistry, and problem-solving.&lt;/p&gt;

&lt;p&gt;In Software: Decomposing a monolithic application involves breaking it down into smaller, more manageable components or services. This process is essential for transitioning to a microservices architecture.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Microservices&lt;/strong&gt;&lt;br&gt;
Definition: Microservices are an architectural style that structures an application as a collection of small, independent services. Each service is designed to perform a specific business function and can be developed, deployed, and scaled independently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Benefits&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scalability: Easily scale individual services based on demand.&lt;/li&gt;
&lt;li&gt;Flexibility: Different teams can work on different services simultaneously.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Resilience: Failure in one service does not necessarily affect the entire system.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Faster Deployment: Independent services can be deployed without affecting the whole application.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Comparison&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Decomposition Process: Decomposing a monolithic application is often the first step towards implementing a microservices architecture. It involves identifying and isolating different functionalities within the monolith and converting them into independent services.&lt;/li&gt;
&lt;li&gt;Implementation: While decomposition is a broader concept, microservices specifically refer to the architectural style that results from this decomposition. Microservices require careful planning, including defining service boundaries, managing inter-service communication, and ensuring data consistency.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
  </channel>
</rss>
