<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ashirwada Dayarathne on Medium]]></title>
        <description><![CDATA[Stories by Ashirwada Dayarathne on Medium]]></description>
        <link>https://medium.com/@ashirwadadayarathne?source=rss-57bc835d06d4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*y0FZZYBwMumQytnfZ2lr3Q.jpeg</url>
            <title>Stories by Ashirwada Dayarathne on Medium</title>
            <link>https://medium.com/@ashirwadadayarathne?source=rss-57bc835d06d4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 17:32:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ashirwadadayarathne/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Achieve Regulatory Compliance using WSO2 Open Banking Accelerator 4.0.0]]></title>
            <link>https://ashirwadadayarathne.medium.com/achieve-regulatory-compliance-using-wso2-open-banking-accelerator-4-0-0-5055e31e0009?source=rss-57bc835d06d4------2</link>
            <guid isPermaLink="false">https://medium.com/p/5055e31e0009</guid>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[wso2-open-banking]]></category>
            <category><![CDATA[wso2-accelerator]]></category>
            <category><![CDATA[open-banking]]></category>
            <category><![CDATA[regulatory-compliance]]></category>
            <dc:creator><![CDATA[Ashirwada Dayarathne]]></dc:creator>
            <pubDate>Fri, 20 Feb 2026 09:52:16 GMT</pubDate>
            <atom:updated>2026-02-20T09:52:16.902Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s regulated financial ecosystem, compliance isn’t optional — it’s foundational. With the emergence of frameworks like PSD2 (Europe), UK Open Banking, and the Australian Consumer Data Standards (CDS), etc., banks and financial institutions are under pressure to deliver open APIs that are both <em>secure</em> and <em>compliant</em>.</p><p>That’s where WSO2 Open Banking Accelerator 4.0.0 [1] steps in — a modern, extensible solution built on WSO2’s proven API and Identity platforms to help financial institutions meet regulatory requirements quickly and confidently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*Q7s_KCKkUENGA3H1SUe4Jg.png" /></figure><h3>Why Regulatory Compliance Matters</h3><p>Open Banking is about empowering customers to securely share their financial data with trusted third-party providers (TPPs). However, this freedom comes with strict regulatory obligations:</p><ul><li>Strong Customer Authentication (SCA) under PSD2</li><li>Financial-grade API (FAPI) conformance for secure data sharing</li><li>Dynamic Client Registration (DCR) using software statements</li><li>Consent management and transparent data access</li><li>Auditing and traceability for regulator reporting</li></ul><p>Without the right infrastructure, achieving compliance can be complex and resource-intensive. That’s the problem WSO2 Open Banking Accelerator 4.0.0 was designed to solve.</p><h3>What’s Inside WSO2 Open Banking Accelerator 4.0.0</h3><p>WSO2 Open Banking Accelerator extends WSO2 API Manager and WSO2 Identity Server with compliance-ready capabilities. Some of the out-of-the-box features it includes:</p><p>1. Financial-grade API (FAPI) Support</p><p>Full FAPI compliance ensures secure and interoperable data exchange. The accelerator supports:</p><ul><li>OAuth 2.0 and OpenID Connect (OIDC)</li><li>JWS-signed requests and responses</li><li>Advanced client authentication flows</li></ul><p>2. Mutual TLS (mTLS) Security</p><p>mTLS ensures all API communications are mutually authenticated between the bank and the TPP, preventing impersonation and man-in-the-middle attacks.</p><p>3. Dynamic Client Registration (DCR) with SSA</p><p>TPPs can register automatically using Software Statement Assertions (SSA) validated against the regulatory directory (e.g., OBIE Directory, CDR Register). This eliminates manual registration errors and ensures that only certified entities onboard.</p><p>4. Consent Management</p><p>Centralized consent handling ensures users always know what they’re sharing and with whom. The accelerator provides:</p><ul><li>Fine-grained scopes (account, transaction, payments)</li><li>Consent creation, update, and revocation APIs</li><li>Transparent consent dashboards for end-users</li></ul><h3>Extending WSO2 Open Banking Accelerator 4.0.0 to achieve Regulatory Compliance</h3><p>In this section, I will explain how to implement extension points in WSO2 Open Banking Accelerator 4.0.0. With this release, OpenAPI-based extensions were introduced, allowing toolkit developers to implement Open Banking specification requirements using their preferred programming language. The OpenAPI extension can be found <a href="https://ob.docs.wso2.com/en/latest/references/accelerator-extensions-api/">here</a>.</p><p>These custom-developed extensions can be deployed externally and tested independently, without requiring a restart of the WSO2 servers.</p><p>The extension API defines the REST contract for services that implement logic to extend the Open Banking Accelerator flows. Extension points are available for the following areas:</p><ul><li>Dynamic Client Registration, update, and retrieval</li><li>Manual Client Registration and update</li><li>Consent creation, retrieval, update, and revocation</li><li>Consent file upload and retrieval</li><li>Consent search</li><li>Consent authorization</li><li>Consent validation</li><li>Error handling</li><li>Token flow</li><li>Authorization flow</li><li>Event creation, subscription, and polling flows</li></ul><h3>Implementing Extensions Using Java</h3><p>In this example, I will use OpenAPI Generator [2], a tool that generates clients, servers, and documentation from OpenAPI 2.0/3.x specifications.</p><ol><li>Download the OpenAPI Extension Swagger file from [3].</li><li>Open a terminal in your preferred working directory and run the following command:</li></ol><p>Syntax</p><pre>openapi-generator-cli generate -i &lt;location-to-swagger-file&gt; -g jaxrs-spec -o &lt;folder-name-to-store-generated-files&gt;</pre><p>Sample</p><pre>openapi-generator-cli generate -i accelerator-extensions-v1.0.3.yaml -g jaxrs-spec -o toolkit</pre><p>It will generate the following folder structure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/1*-Xqdwv_b5ECaIy4pdTLlaA.png" /></figure><p>You can now proceed with implementing the extensions based on your specific business requirements. Once development is complete, the toolkit implementation can be deployed in WSO2 API Manager (APIM), WSO2 Identity Server (IS), or any external hosting environment of your choice.</p><p>The toolkit REST APIs can be secured using Basic Authentication or OAuth 2.0, depending on your security requirements and deployment architecture.</p><p>After implementing your customizations, you need to enable OpenAPI-based extensions in the WSO2 Open Banking Accelerator.</p><p>To do this, locate the following configuration in the <em>deployment.toml </em>file, which is available in the <em>/repository/conf</em> directory, and enable it to configure the external service extension.</p><pre>[financial_services.extensions.endpoint]<br>enabled = true<br>base_url = &quot;&lt;BASE_URL_OF THE EXTENSION&gt;&quot;<br>allowed_extensions = [&quot;pre_process_client_creation&quot;, &quot;pre_process_client_update&quot;, &quot;pre_process_client_retrieval&quot;, &quot;pre_process_consent_creation&quot;,<br>&quot;enrich_consent_creation_response&quot;, &quot;pre_process_consent_retrieval&quot;, &quot;pre_process_consent_bulk_retrieval&quot;,<br>&quot;pre_process_consent_revoke&quot;, &quot;populate_consent_authorize_screen&quot;, &quot;persist_authorized_consent&quot;, &quot;validate_consent_access&quot;,<br>&quot;validate_refresh_token_issuance&quot;, &quot;validate_authorization_request&quot;, &quot;enrich_event_subscription_response&quot;,<br>&quot;validate_event_creation&quot;, &quot;validate_event_polling&quot;, &quot;enrich_event_polling_response&quot;, &quot;map_accelerator_error_response&quot;]<br><br>[financial_services.extensions.endpoint.security]<br># supported types : Basic-Auth or OAuth2<br>type = &quot;Basic-Auth&quot;<br>username = &quot;&quot;<br>password = &quot;&quot;</pre><h3>What to watch out for / Implementation tips</h3><p>While version 4.0.0 brings many improvements, implementing any open-banking / open-finance platform is still non-trivial. Here are some key considerations:</p><ul><li><strong>Understand your regulatory context</strong>: Different markets impose different rules (data sharing scope, consent lifetime, strong customer authentication, sandbox vs production). The accelerator supports many common flows but you will likely need region-specific customizations.</li><li><strong>Plan for extension from Day-0</strong>: While the Accelerator handles many common flows, you will likely need to connect to legacy core banking systems, reporting systems, and partner ecosystems. Use the OpenAPI extension model early to avoid future bottlenecks.</li><li><strong>Idempotency and API reliability matter</strong>: Financial APIs often need to guarantee “once-and-only-once” or at least “safe multiple calls” behaviours. Make sure you define idempotency keys or unique request identifiers.</li><li><strong>Security is foundational, not optional</strong>: Features like FAPI, RAR, consent flows — but you still must harden the deployment, monitor for threats, update patch-levels often.</li><li><strong>Developer &amp; ecosystem support</strong>: Build APIs with developer-friendly portals, sandbox access, test harnesses. Even though the accelerator provides many features, the success of open finance often depends on how easy TPPs can integrate.</li><li><strong>Data governance and privacy</strong>: Open finance is as much about sharing as about protecting data. Make sure your consent management, logging, audit, deletion/expiry workflows are in place.</li><li><strong>Scalability &amp; performance</strong>: Opening APIs to 3rd parties increases load, potential for abuse. Leverage the ability to throttle, monitor and manage traffic.</li><li><strong>Migration strategy</strong>: If you already have an older version of the accelerator (or a bespoke stack), plan how you will migrate or integrate with version 4.0.0. Review compatibility, data models and extension points.</li></ul><h3>Beyond Compliance: Building Trust and Innovation</h3><p>Regulatory compliance is just the starting point. Once the foundation is secure, institutions can leverage WSO2’s open ecosystem to:</p><ul><li>Launch premium APIs for partners</li><li>Integrate with FinTech ecosystems faster</li><li>Enable personalized banking experiences through consented data sharing</li><li>Innovate safely while maintaining regulatory trust</li></ul><h3>Conclusion</h3><p>Achieving regulatory compliance doesn’t have to be an uphill battle. With WSO2 Open Banking Accelerator 4.0.0, financial institutions can accelerate compliance, enhance trust, and focus on innovation — not infrastructure.</p><p>Whether you’re preparing for PSD2, CDR, or any future regulation, WSO2 provides the flexibility and robustness you need to stay ahead of the curve.</p><p>[1] <a href="https://medium.com/@ashirwadadayarathne/the-evolution-of-open-banking-spotlight-on-wso2-open-banking-accelerator-4-0-0-604691642233">The Evolution of Open Banking: Spotlight on WSO2 Open Banking Accelerator 4.0.0</a></p><p>[2] <a href="https://openapi-generator.tech/">https://openapi-generator.tech/</a></p><p>[3] <a href="https://ob.docs.wso2.com/en/latest/references/accelerator-extensions-api/">https://ob.docs.wso2.com/en/latest/references/accelerator-extensions-api/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5055e31e0009" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Evolution of Open Banking: Spotlight on WSO2 Open Banking Accelerator 4.0.0]]></title>
            <link>https://ashirwadadayarathne.medium.com/the-evolution-of-open-banking-spotlight-on-wso2-open-banking-accelerator-4-0-0-604691642233?source=rss-57bc835d06d4------2</link>
            <guid isPermaLink="false">https://medium.com/p/604691642233</guid>
            <category><![CDATA[open-banking]]></category>
            <category><![CDATA[open-finance]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[open-banking-accelerator]]></category>
            <dc:creator><![CDATA[Ashirwada Dayarathne]]></dc:creator>
            <pubDate>Sun, 26 Oct 2025 17:34:03 GMT</pubDate>
            <atom:updated>2025-10-26T17:34:03.834Z</atom:updated>
            <content:encoded><![CDATA[<p>In the rapidly evolving world of open banking and open finance, compliance, agility, and developer-friendliness are critical. The release of the WSO2 Open Banking Accelerator 4.0.0 marks a significant milestone in this journey, offering organizations a more robust foundation for meeting regulatory demands and enabling open banking innovation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/1*bkhtYKKfUyFYiqQNFrmslw.png" /></figure><h4>What is the WSO2 Open Banking Accelerator?</h4><p>The WSO2 Open Banking Accelerator is a pre-packaged solution built by WSO2 to help banks, fintechs, and financial institutions jump-start their open banking / open finance programs. Instead of building from scratch all the infrastructure, APIs, identity &amp; consent flows, the Accelerator offers:</p><ul><li>Pre-configured identity &amp; access management (IAM) and API management stacks aligned with open banking requirements</li><li>Out-of-the-box support for standard flows (consent, dynamic client registration)</li><li>Extensibility points so you can adapt to region-specific regulations and business models</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bzfiNy0vP8jBaAxRMiZrqg.png" /></figure><p>In short, the Accelerator aims to reduce the time, risk, and cost of implementing an open banking platform, allowing organizations to focus more on differentiating services rather than reinventing compliance frameworks.</p><h3>Why 4.0.0 matters &amp; what’s new</h3><p>Version 4.0.0 of the Accelerator is the successor of 3.0.0, intending to expand coverage from purely open banking into broader open finance, while improving developer experience and extension flexibility.</p><p>WSO2 Open Banking Accelerator 4.0.0 is a collection of technologies that increases the speed and reduces the complexity of adopting open banking compliance which runs on top of WSO2 Identity Server and WSO2 API Manager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AWKiEJbHSqbzIA5Ej6C_qA.png" /></figure><p>Here are some of the key additions and enhancements:</p><h4>Enhanced features</h4><ul><li>Generalized consent management support for common open banking / open finance use-cases (rather than narrowly banking-specific).</li><li>Native support for Financial-grade API (FAPI) security and OAuth2 Rich Authorization Request (RAR) flows.</li><li>Support for both pre-initiated consent flows and scope-based consent flows at the accelerator layer.</li><li>Open API based extension points (in addition to Java-based extensions) to allow faster, lighter-weight customization; Allows developers to use their preferred developing language.</li><li>Support for JDK 21 runtime, keeping the stack modern.</li><li>Idempotency feature support from the accelerator layer — important for financial APIs (where repeated calls must not lead to unintended side-effects).</li></ul><h4>What has changed / evolved</h4><ul><li>The focus has shifted from just “open banking” to “open finance” — meaning a broader domain, more data-sharing, more ecosystem players.</li><li>Extension model improved: Open API based, giving more flexibility to customize the accelerator without heavy Java coding.</li><li>The architecture acknowledges multiple deployment patterns (e.g., IAM only vs API-Gateway + IAM) and tries to simplify setup.</li></ul><h3>Why this matters for banks &amp; fintechs</h3><ul><li><strong>Compliance acceleration</strong>: Many regions are moving towards open banking and coming up with new regulations. Instead of starting from scratch, the accelerator provides a ready framework.</li><li><strong>Time-to-market</strong>: With many common capabilities pre-built (client registration, consent, idempotency, FAPI security), you can focus on business logic (products, monetization) rather than plumbing.</li><li><strong>Developer empowerment</strong>: The Open API extension model means faster customization by teams who may prefer API-first approaches.</li></ul><h3>Conclusion: Is WSO2 Open Banking Accelerator 4.0.0 for you?</h3><p>If you are an organization (bank, neobank, fintech) embarking on open banking / open finance:</p><ul><li>If you have time-to-market pressure, heavy regulatory demands, or need a robust framework: Yes, this accelerator is a strong candidate.</li><li>If you are already deeply custom and have built your own stack, you may still gain value by adopting parts of it (consent management, idempotency, dynamic client registration) and reusing its extensibility model.</li><li>If you operate in a highly regulated jurisdiction or with non-standard flows, ensure you evaluate how much customization will be needed and whether the open API extension model fits your team.</li><li>Importantly, this is not a plug-and-play “done” solution — you still need design, deployment, governance, monitoring and integration effort. But it significantly lowers the barrier.</li></ul><p>As open banking gains momentum globally, using a purpose-built, compliance-aware accelerator such as WSO2’s version 4.0.0 can provide you with both speed and foundation to scale. The key will be how you build the rest of your ecosystem — developer engagement, partner models, APIs as products, data governance — on top of that foundation.</p><p>[1] <a href="https://wso2.com/solutions/financial-services/open-banking/">https://wso2.com/solutions/financial-services/open-banking/</a></p><p>[2] <a href="https://ob.docs.wso2.com/en/latest/get-started/open-banking/">https://ob.docs.wso2.com/en/latest/get-started/open-banking/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=604691642233" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mocking Static Methods With Mockito]]></title>
            <link>https://ashirwadadayarathne.medium.com/mocking-static-methods-with-mockito-e53c5afe2971?source=rss-57bc835d06d4------2</link>
            <guid isPermaLink="false">https://medium.com/p/e53c5afe2971</guid>
            <category><![CDATA[mockedstatic]]></category>
            <category><![CDATA[testng]]></category>
            <category><![CDATA[mockstatic]]></category>
            <category><![CDATA[static-methods-java]]></category>
            <category><![CDATA[mockito]]></category>
            <dc:creator><![CDATA[Ashirwada Dayarathne]]></dc:creator>
            <pubDate>Wed, 17 Jul 2024 07:00:25 GMT</pubDate>
            <atom:updated>2024-07-17T07:00:25.288Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nRynoqoBPtI4XhIw5bruUw.png" /></figure><p>Unit Testing….. Every software developer must have heard this term, and of course, have written unit tests. Unit testing is used to test an isolated code block, mostly a function or method. Developers can validate the code using unit tests and verify it performs the theoretical logic.</p><p>While writing unit tests, have you come across a situation where you got stuck in writing automated tests for a class since it uses static methods. Yes, I have, often because code interacts with external dependencies. Although the best practice is to refactor the code so that it no longer uses static methods, in some cases this isn’t possible. However, unit tests must not interact with those dependencies. When writing unit tests, we should not try to mock these external dependencies, as we have not implemented them.</p><p>Previous to version 3.4.0 of Mockito, it could not mock static methods, instead we used PowerMockito. But in version 3.4.0 and later, we have in built capability in Mockito to mock static methods.</p><h3>MockedStatic Object</h3><p>To mock a static method, we can wrap the class containing the static method by “inline mock maker”. <em>MockedStatic</em> instance retrieved via <em>Mockito.mockStatic</em> method can be used to mock the static methods from a class. This can be done as via two ways:</p><p>First way — Using <em>try-with-resource</em> block</p><pre>try (MockedStatic&lt;DemoUtils&gt; demoUtilsMock = Mockito.mockStatic(DemoUtils.class)) {<br>. . .<br>}</pre><p>Second way — Registering and deregistering the static mocks separately</p><pre>MockedStatic&lt;DemoUtils&gt; demoUtilsMock = Mockito.mockStatic(DemoUtils.class);<br>. . .<br>demoUtilsMock.close();</pre><p>Every time we created a mockStatic instance, it has to be closed. Else, it will lead to side effects in running tests in the same thread when the same static method is involved. Therefore, the first option seems better, and I will discuss both the ways.</p><h3>Add the Maven Dependency</h3><p>Unit tests used for this are written using <a href="https://testng.org/">TestNG</a> and <a href="https://site.mockito.org/">Mockito</a>. I have used TestNG v7.10.1, Mockito v5.3.1 and Mockito TestNG v0.5.2.</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.testng&lt;/groupId&gt;<br>    &lt;artifactId&gt;testng&lt;/artifactId&gt;<br>    &lt;version&gt;7.10.1&lt;/version&gt;<br>    &lt;scope&gt;test&lt;/scope&gt;<br>&lt;/dependency&gt;<br>&lt;dependency&gt;<br>    &lt;groupId&gt;org.mockito&lt;/groupId&gt;<br>    &lt;artifactId&gt;mockito-core&lt;/artifactId&gt;<br>    &lt;version&gt;5.3.1&lt;/version&gt;<br>    &lt;scope&gt;test&lt;/scope&gt;<br>&lt;/dependency&gt;<br>&lt;dependency&gt;<br>    &lt;groupId&gt;org.mockito&lt;/groupId&gt;<br>    &lt;artifactId&gt;mockito-testng&lt;/artifactId&gt;<br>    &lt;version&gt;0.5.2&lt;/version&gt;<br>    &lt;scope&gt;test&lt;/scope&gt;<br>&lt;/dependency&gt;</pre><h3>Mock Method Invocation</h3><p>For demonstration purposes, let’s use below two classes.</p><h4>DemoUtils class</h4><pre>package mockito.demo;<br><br>import java.text.DateFormat;<br>import java.text.SimpleDateFormat;<br>import java.time.LocalDate;<br>import java.util.Date;<br><br>public class DemoUtils {<br>    public static LocalDate getCurrentDate() {<br><br>        return LocalDate.now();<br>    }<br><br>    public static String convertToISO8601(long dateValue){<br><br>        DateFormat dateFormat = new SimpleDateFormat(&quot;yyyy-MM-dd&#39;T&#39;HH:mm:ssXXX&quot;);<br>        Date date = new Date(dateValue * 1000);<br>        return dateFormat.format(date);<br>    }<br>}</pre><h4>Demo class</h4><pre>package mockito.demo;<br><br>import org.json.JSONObject;<br><br>public class Demo {<br><br>    private Demo() {<br>    }<br><br>    public static JSONObject constructResponse(String id, String status) {<br><br>        JSONObject response = new JSONObject();<br>        response.put(&quot;ID&quot;, id);<br>        response.put(&quot;CREATED_TIME&quot;, DemoUtils.getCurrentDate());<br>        response.put(&quot;STATUS&quot;, status);<br>        return response;<br>    }<br><br>    public static JSONObject constructStatusUpdateResponse(String id, long updateTime, String status) {<br><br>        JSONObject response = new JSONObject();<br>        response.put(&quot;ID&quot;, id);<br>        response.put(&quot;UPDATED_TIME&quot;, DemoUtils.convertToISO8601(updateTime));<br>        response.put(&quot;STATUS&quot;, status);<br>        return response;<br>    }<br>}</pre><h3>Mocking a No Argument Static Method</h3><p>Mocking a static method with no argument is the simplest case of mocking static methods. To mock a method with no argument, we need to pass the method reference to when method. The return value will be specified in thenReturn methods as usual.</p><p>Let’s go ahead and see how I have mocked the constructResponse method from our Demo class:</p><pre>@Test<br>void testStaticMethodWithNoArgs() {<br><br>    try (MockedStatic&lt;DemoUtils&gt; demoUtilsMock = Mockito.mockStatic(DemoUtils.class)) {<br><br>        demoUtilsMock.when(DemoUtils::getCurrentDate).thenReturn(LocalDate.now());<br><br>        JSONObject jsonObject = Demo.constructResponse(UUID.randomUUID().toString(), &quot;CREATED&quot;);<br><br>        Assert.assertNotNull(jsonObject);<br>        Assert.assertEquals(jsonObject.get(&quot;CREATED_TIME&quot;), LocalDate.now());<br>    }<br>}</pre><h3>Mocking a Static Method With Arguments</h3><p>When we have a static method with some arguments, we need to use a lambda expression instead of the method reference. We can use the standard methods (e.g. then, thenRetun, thenThrow etc.) to handle the return value.</p><p>Now let’s see how I have mocked the constructStatusUpdateResponse method from the Demo class that has arguments:</p><pre>@Test<br>void testStaticMethodWithArgs() {<br><br>    try (MockedStatic&lt;DemoUtils&gt; demoUtilsMock = Mockito.mockStatic(DemoUtils.class)) {<br>      <br>      OffsetDateTime offsetDateTime = OffsetDateTime.now();<br>      demoUtilsMock.when(() -&gt; DemoUtils.convertToISO8601(anyLong())).thenReturn(offsetDateTime.toString());<br>      <br>      JSONObject jsonObject = Demo.constructStatusUpdateResponse(UUID.randomUUID().toString(), offsetDateTime.toEpochSecond(), &quot;CREATED&quot;);<br>      <br>      Assert.assertNotNull(jsonObject);<br>      Assert.assertEquals(jsonObject.get(&quot;UPDATED_TIME&quot;), offsetDateTime.toString());<br>    }<br>}</pre><p>The test class will look like below.</p><pre>package mockito.demo;<br><br>import mockito.demo.Demo;<br>import mockito.demo.DemoUtils;<br>import org.json.JSONObject;<br>import org.mockito.MockedStatic;<br>import org.mockito.Mockito;<br>import org.testng.Assert;<br>import org.testng.annotations.Test;<br><br>import java.time.LocalDate;<br>import java.time.OffsetDateTime;<br>import java.util.UUID;<br><br>import static org.mockito.ArgumentMatchers.anyLong;<br><br>public class DemoTest {<br><br>    @Test<br>    void testStaticMethodWithNoArgs() {<br><br>        try (MockedStatic&lt;DemoUtils&gt; demoUtilsMock = Mockito.mockStatic(DemoUtils.class)) {<br>        <br>            demoUtilsMock.when(DemoUtils::getCurrentDate).thenReturn(LocalDate.now());<br>  <br>            JSONObject jsonObject = Demo.constructResponse(UUID.randomUUID().toString(), &quot;CREATED&quot;);<br>  <br>            Assert.assertNotNull(jsonObject);<br>            Assert.assertEquals(jsonObject.get(&quot;CREATED_TIME&quot;), LocalDate.now());<br>        }<br>    }<br><br>    @Test<br>    void testStaticMethodWithArgs() {<br><br>        try (MockedStatic&lt;DemoUtils&gt; demoUtilsMock = Mockito.mockStatic(DemoUtils.class)) {<br><br>            OffsetDateTime offsetDateTime = OffsetDateTime.now();<br>            demoUtilsMock.when(() -&gt; DemoUtils.convertToISO8601(anyLong())).thenReturn(offsetDateTime.toString());<br>    <br>            JSONObject jsonObject = Demo.constructStatusUpdateResponse(UUID.randomUUID().toString(), offsetDateTime.toEpochSecond(), &quot;CREATED&quot;);<br>            <br>            Assert.assertNotNull(jsonObject);<br>            Assert.assertEquals(jsonObject.get(&quot;UPDATED_TIME&quot;), offsetDateTime.toString());<br>        }<br>    }<br>}</pre><h3>Mocking different classes in the same test</h3><p>Let’s assume I have written another class (CommonUtil) with static methods. I use the static method inside the constructResponse method in the Demo class.</p><h4>CommonUtil class</h4><pre>package mockito.demo;<br><br>public class CommonUtil {<br><br>    public static String getResponseStatus() {<br>        return &quot;CREATED&quot;;<br>    }<br>}</pre><h4>constructResponse method</h4><pre>public static JSONObject constructResponse(String id, String status) {<br><br>  JSONObject response = new JSONObject();<br>  response.put(&quot;ID&quot;, id);<br>  response.put(&quot;CREATED_TIME&quot;, DemoUtils.getCurrentDate());<br>  response.put(&quot;STATUS&quot;, CommonUtil.getResponseStatus());<br>  return response;<br>}</pre><p>I need to mock both DemoUtil and CommonUtil classes to test, and can add both the static mocks inside the same try-with-resource block as follows.</p><pre>@Test<br>void testStaticMethodWithNoArgs() {<br><br>    try (MockedStatic&lt;DemoUtils&gt; demoUtilMock = Mockito.mockStatic(DemoUtils.class);<br>        MockedStatic&lt;CommonUtil&gt; commonUtilMock = Mockito.mockStatic(CommonUtil.class)) {<br><br>        demoUtilMock.when(DemoUtils::getCurrentDate).thenReturn(LocalDate.now());<br>        commonUtilMock.when(CommonUtil::getResponseStatus).thenReturn(&quot;CREATED&quot;);<br><br>        JSONObject jsonObject = Demo.constructResponse(UUID.randomUUID().toString(), &quot;CREATED&quot;);<br><br>        Assert.assertNotNull(jsonObject);<br>        Assert.assertEquals(jsonObject.get(&quot;CREATED_TIME&quot;), LocalDate.now());<br>        Assert.assertEquals(jsonObject.get(&quot;STATU&quot;), &quot;CREATED&quot;);<br>    }<br>}</pre><h3>Mocking without try-with-resource block</h3><p>Below is the full test class without using the try-with-resource block to mock the static methods. In this method I have to register the mocks per thread, inside @BeforeClass method and deregister the mocks before registering a new static mock using @AfterClass.</p><pre>package mockito.demo;<br><br>import org.json.JSONObject;<br>import org.mockito.MockedStatic;<br>import org.mockito.Mockito;<br>import org.testng.Assert;<br>import org.testng.annotations.AfterClass;<br>import org.testng.annotations.BeforeClass;<br>import org.testng.annotations.Test;<br>import mockito.demo.Demo;<br>import mockito.demo.DemoUtils;<br><br>import java.time.LocalDate;<br>import java.time.OffsetDateTime;<br>import java.util.UUID;<br><br>import static org.mockito.ArgumentMatchers.anyLong;<br><br>public class DemoTest {<br><br>    MockedStatic&lt;DemoUtils&gt; demoUtilsMock;<br>    <br>    @BeforeClass<br>    public void setUp() {<br>        demoUtilsMock = Mockito.mockStatic(DemoUtils.class);<br>    }<br><br>    @AfterClass<br>    public void tearDown() {<br>        demoUtilsMock.close();<br>    }<br><br>    @Test<br>    void testStaticMethodWithNoArgs() {<br><br>        demoUtilsMock.when(DemoUtils::getCurrentDate).thenReturn(LocalDate.now());<br><br>        JSONObject jsonObject = Demo.constructResponse(UUID.randomUUID().toString(), &quot;CREATED&quot;);<br><br>        Assert.assertNotNull(jsonObject);<br>        Assert.assertEquals(jsonObject.get(&quot;CREATED_TIME&quot;), LocalDate.now());<br>    }<br><br>    @Test<br>    void testStaticMethodWithArgs() {<br><br>        OffsetDateTime offsetDateTime = OffsetDateTime.now();<br>        demoUtilsMock.when(() -&gt; DemoUtils.convertToISO8601(anyLong())).thenReturn(offsetDateTime.toString());<br><br>        JSONObject jsonObject = Demo.constructStatusUpdateResponse(UUID.randomUUID().toString(), offsetDateTime.toEpochSecond(), &quot;CREATED&quot;);<br><br>        Assert.assertNotNull(jsonObject);<br>        Assert.assertEquals(jsonObject.get(&quot;UPDATED_TIME&quot;), offsetDateTime.toString());<br>    }<br>}</pre><p>If we do not deregister the existing mock and register a new mock in the same thread, it will throw “static mocking is already registered in the current thread” exception. In the example above, we use setUp() method annotated with @BeforeClass to register the DemoUtils mock and deregistered the mock in the tearDown() method annotated with @AfterClass.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e53c5afe2971" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating Your First Package with Ballerina]]></title>
            <link>https://ashirwadadayarathne.medium.com/creating-your-first-package-with-ballerina-f20b05f9c8ba?source=rss-57bc835d06d4------2</link>
            <guid isPermaLink="false">https://medium.com/p/f20b05f9c8ba</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[ballerina]]></category>
            <category><![CDATA[first-package]]></category>
            <dc:creator><![CDATA[Ashirwada Dayarathne]]></dc:creator>
            <pubDate>Tue, 21 Mar 2023 16:40:38 GMT</pubDate>
            <atom:updated>2023-03-21T16:40:38.988Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/307/1*nVonHpXMQCYgLfolN19Jaw.png" /></figure><p>Ballerina is an open-source programming language for the cloud that makes it easier to use, combine, and create network services.</p><h4>Why Ballerina</h4><ul><li>Cloud native</li><li>Flexibly Typed</li><li>Data Oriented</li><li>Graphical</li><li>Concurrent</li><li>Reliable and Maintainable</li></ul><h4>Setting Up Ballerina</h4><ul><li>Download Ballerina</li><li>Install</li><li>Install VS code extension</li></ul><p><a href="https://ballerina.io/learn/install-ballerina/set-up-ballerina/">https://ballerina.io/learn/install-ballerina/set-up-ballerina/</a></p><p><strong>bal</strong></p><ul><li>Ballerina build tool and package manager</li><li>helps you to create, build, test, and run your package</li></ul><h4><strong>Check ballerina version</strong></h4><pre>bal verison</pre><h4>Creating a new bal package</h4><pre>bal new hello</pre><p>This command will create the following structure. Root directory will be considered as the default module of the package.</p><ul><li>Ballerina.toml — contains package metadata and bal tool uses this file to identify the root</li><li>main.bal — main source file of the package</li></ul><pre>hello/<br>├── Ballerina.toml<br>└── main.bal</pre><h4>Naming practises</h4><ul><li>only contain alphanumerics, underscores, and periods and the maximum length is 256 characters.</li><li>When a package provides multiple functionalities, it is better to split it into multiple packages. For scenarios like this, you can give a hierarchical name to the package by using a dot (.).</li></ul><pre>hello<br>greeting<br>validation.header</pre><h4>Package Structure</h4><ul><li>To build an organised code Ballerina have come with the concept of packages and modules.</li><li>This concept will make it easy to write clean code by eliminating repetitions, writing reusable code, adding new features without changing the existing code, etc.</li><li>Package is the single shareable unit of the Ballerina Code. It can be a collection on modules.</li><li>Module is the place where the source files, test files and resources are wrapped.</li><li>Ballerina code is organised in a single shareable unit called a package.</li><li>Package should have at least one module named as default module. In small projects like what we created initially root directory is the default module.</li></ul><h4>Lets print Hello World!</h4><p>You can either run code . inside the hello directory or manually add below code inside the main.bal file.</p><pre>import ballerina/io;</pre><pre>public function main() {    <br>	io:println(&quot;Hello, World!&quot;);<br>}</pre><h4>Run the package</h4><p>There are two ways to run the package.</p><ol><li>Run bal run in your terminal to run this package.</li></ol><pre>$ bal run<br>Compiling source<br>	example/hello:0.1.0</pre><pre>Running executable</pre><pre>Hello, World!</pre><p>2. Generate an executable program with bal build, and then, use bal run as follows.</p><pre>$ bal build <br>Compiling source <br>  example/greeter:0.1.0 <br><br>Generating executable <br>  target/bin/greeter.jar <br><br>$ bal run target/bin/greeter.jar <br>Hello, World</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f20b05f9c8ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Java Flight Recorder With OpenJDK 11 for WSO2 Products]]></title>
            <link>https://ashirwadadayarathne.medium.com/using-java-flight-recorder-with-openjdk-11-for-wso2-products-e66828a73374?source=rss-57bc835d06d4------2</link>
            <guid isPermaLink="false">https://medium.com/p/e66828a73374</guid>
            <category><![CDATA[jmc]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[open-banking]]></category>
            <category><![CDATA[jfr]]></category>
            <dc:creator><![CDATA[Ashirwada Dayarathne]]></dc:creator>
            <pubDate>Mon, 09 May 2022 07:04:53 GMT</pubDate>
            <atom:updated>2022-05-09T07:07:56.495Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*rFGVxUY59bRwRSquwxJ6dg.png" /></figure><p>This blog explains how to configure a Java Flight Recorder for WSO2 Open Banking 2.0.0.</p><p><strong>What is a Java Flight Recorder?</strong></p><p>Java Flight Recorder ( JFR ) is a tool provided by Java from the JDK release 7u40 or above. This is a profiler to determine which parts of your code are causing large amounts of memory allocation or causing excess CPU to be consumed. Refer to [1] for more information on JFR.</p><p>Production systems are daily exposed to huge traffic and sometimes these production systems are not serving requests as expected. In those kinds of scenarios, we need a way to figure out what went wrong in the past few hours. JFR is a tool, which can help us to analyze, which part of the logic causing the delay or takes time to execute.</p><p>With Java Flight Recorder, If we have already enabled it, It is very easy to figure out what went wrong with the information on</p><ul><li>Memory Usage</li><li>CPU Usage</li><li>Thread Usage</li><li>Etc.</li></ul><p>This article explains how to configure a Time Fixed Recording (Profiling Recording) using the Diagnostic Command for WSO2 Open Banking 2.0.0 with JFR. In order to configure a WSO2 server to Time Fixed record this information, You can change the startup script of the WSO2 server as follows.</p><p><strong>Configure Java Flight Recording</strong></p><ul><li>To configure the Java Flight Recorder, we need to add the following code lines to the <strong>wso2server.sh</strong> file, which resides in the bin directory of the WSO2 server. Then start the server.</li></ul><pre>-XX:+UnlockCommercialFeatures \</pre><pre>-XX:+FlightRecorder \</pre><pre>-XX:StartFlightRecording=disk=true,dumponexit=true,filename=recording.jfr,maxsize=1024m,maxage=1d,settings=profile \</pre><ul><li>To start a 60-second recording of the running Java process and save it to recording.jfr in the current directory, use the following command. &lt;PID&gt; refers to the process ID of the java application.</li></ul><pre>jcmd &lt;PID&gt; JFR.start duration=60s filename=recording.jfr</pre><ul><li>To stop the recording before the specified time, use the below command.&lt;PID&gt; refers to the process ID of the java application.</li></ul><pre>jcmd &lt;PID&gt; JFR.dump filename=recording.jfr</pre><p>Where</p><ul><li><strong><em>disk</em></strong> — Use this parameter to specify whether to write data to disk while recording. By default, this parameter is true.</li><li><strong><em>dumponexit</em></strong> — Use this parameter to specify if the running recording is dumped when the JVM shuts down. By default, this parameter is false.</li></ul><p>If the parameter is enabled and a file name is not set, the recording is written to a file in the directory where the recording progress has started. The file name is a system-generated name that contains the process ID, recording ID, and current timestamp. For example, hotspot-pid-47496-id-1- 2018_01_25_19_10_41.jfr.</p><ul><li><strong><em>filename</em></strong> — Use this parameter to specify the path and name of the recording file</li><li><strong><em>maxsize</em></strong> — Use this parameter to configure the amount of data stored by the default recording in the repository as an absolute amount of bytes</li><li><strong><em>maxage</em></strong> — Use this parameter to specify the maximum number of days the recording should be available on the disk, can be specified by s (seconds), m (minutes), h (hours), or d (days)</li><li><strong><em>settings</em></strong> — Use this parameter to specify the path and name of the event settings file (of type JFC).</li></ul><p>By default, neither the maximum size of the recording nor the maximum age nor recorded data is limited. There were more settings in earlier JDK versions, but those have been simplified in JDK 11.</p><p>JFR comes with two factory-made profiles (default and profile), and they define what events should be persisted in captured recordings. When the settings options aren’t specified, the default profile is used.</p><p><strong>Visualize Data</strong></p><p>Through JFR, all data will be dumped as a file with *.jfr extension during runtime. These binary files can be viewed from Java Mission Control (JMC), which is part of the JDK distribution. ​​JFR doesn’t have a standalone tool. Therefore, we use Java Mission Control (JMC), which contains a plugin that allows us to visualize the data collected by JFR. This helps to visualize the data about the events in an intuitive way. The following diagrams show the sample *.jfr dump file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Otmr3m7gKd30LmibdfQHHQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aQrzY83DWSlywuAGrp5Wlg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k0vOxUQBLFUW3I_8gZ5qTw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aijoK8qL_7yR6ae2ihm--g.png" /></figure><p>The main screen shows the information about the summary of the java application, including all captured details. Also, all the details captured are demonstrated separately under topics like Threads, Memory, File I/O, Socket I/O, etc.</p><p><strong>Conclusion</strong></p><p>Java Flight Recorder (JFR) is a profiling tool used to gather diagnostics and profiling data from a running Java application. It collects data about the running threads, GC cycles, locks, sockets, memory usage, and a lot more. To analyze the JFR report, Java Mission Control, which is a tool for analyzing recordings that have been open-sourced, can be used.</p><p>Java Mission Control isn’t bundled with the JDK as of version 11, but it’s available as a separate <a href="https://jdk.java.net/jmc/">download</a>. JFR and JMC are new to the <a href="https://dzone.com/refcardz/introduction-to-cloud-native-java">OpenJDK’s open-source</a> space, and OpenJDK 11 is also very recent at the time of writing. Therefore, some time must pass to allow these tools to mature.</p><p>[1] <a href="https://www.javacodegeeks.com/2015/01/java-flight-recorder-jfr.html">https://www.javacodegeeks.com/2015/01/java-flight-recorder-jfr.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e66828a73374" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OpenID Connect Client Initiated Backchannel Authentication Flow — CIBA]]></title>
            <link>https://ashirwadadayarathne.medium.com/openid-connect-client-initiated-backchannel-authentication-flow-ciba-e24e8ad2df33?source=rss-57bc835d06d4------2</link>
            <guid isPermaLink="false">https://medium.com/p/e24e8ad2df33</guid>
            <dc:creator><![CDATA[Ashirwada Dayarathne]]></dc:creator>
            <pubDate>Wed, 18 Nov 2020 04:30:40 GMT</pubDate>
            <atom:updated>2020-11-18T04:30:40.930Z</atom:updated>
            <content:encoded><![CDATA[<h3>OpenID Connect Client Initiated Backchannel Authentication Flow — CIBA</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*LuBd-UDz_-LC497fRVwp8A.png" /></figure><ul><li>OpenID Providers (OPs)</li></ul><p>OAuth 2.0 Authorization Servers implementing OpenID Connect and CIBA are also referred to as OpenID Providers (OPs).</p><ul><li>Relying Parties (RPs)</li></ul><p>OAuth 2.0 Clients using OpenID Connect and CIBA are also referred to as Relying Parties (RPs)</p><ul><li>Consumption Device (CD)</li></ul><p>The Consumption Device is the device that helps the user consume the service. In the CIBA use case, the user is not necessarily in control of the CD. For example, the CD may be in the control of an RP agent (e.g. at a bank teller) or may be an RP controlled device (e.g. a petrol pump).</p><ul><li>Authentication Device (AD)</li></ul><p>The device on which the user will authenticate and authorize the request, often a smartphone.</p><h3>Client Initiated Backchannel Authentication (CIBA)</h3><p>Client Initiated Backchannel Authentication (CIBA) enables a Client to initiate the authentication of an end-user by means of out-of-band mechanisms.</p><ol><li>The Client shall make an “HTTP POST” request to the Backchannel Authentication Endpoint to ask for end-user authentication.</li><li>The OP will respond immediately with a unique identifier that identifies that authentication while it tries to authenticate the user in the background.</li><li>The Client will receive the ID Token, Access Token and optionally Refresh Token by means of either the Poll, Ping or Push modes, this choice MUST be established by the Client at registration time.</li></ol><ul><li><strong><em>Poll Mode</em><br></strong>When configured in Poll mode, the Client will poll the token endpoint to get a response with the tokens.</li><li><strong><em>Ping Mode</em><br></strong>When configured in Ping mode, the OP will send a request to a callback URI previously registered by the Client with the unique identifier returned from the Backchannel Authentication Endpoint. Upon receipt of the notification, the Client makes a request to the token endpoint to obtain the tokens.</li><li><strong><em>Push Mode</em><br></strong>When configured in Push mode, the OP will send a request with the tokens to a callback URI previously registered by the Client.</li></ul><p><strong>Grant Type</strong></p><p>CIBA specificatio introduces the CIBA grant type — urn:openid:params:grant-type:ciba</p><p><strong>OpenID Provider Metadata</strong></p><p>Following authorization server metadata parameters are introduced by this specification for OPs publishing their support of the CIBA flow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UBkXWjvugykaDQQkvjmIoQ.png" /></figure><p>The CIBA grant type is used in the grant_types_supported field of discovery metadata for OPs that support the ping or poll delivery modes.</p><p><strong>Client Metadata</strong></p><p>Clients registering to use CIBA MUST indicate a token delivery mode.</p><p>When using the ping or poll mode, the Client MUST include the CIBA grant type in the “grant_types” field.</p><p>When using the ping or push mode, the Client MUST register a client notification endpoint.</p><p>Clients intending to send signed authentication requests MUST register the signature algorithm that will be used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JL3zQpKPWGvsGE_8ZSqsUA.png" /></figure><p>The token_endpoint_auth_method indicates the registered authentication method for the client to use when making direct requests to the OP, including requests to both the token endpoint and the backchannel authentication endpoint.</p><p><strong>Poll, Ping and Push Modes</strong></p><p>Allows the Client to get the authentication result in three ways:</p><p>Poll mode — the authentication result is retrieved by the Client by polling the OP’s token endpoint using the new grant type.</p><p>Ping mode — the OP will post the unique identifier of the authentication session to the Client, the Client will then retrieve the authentication result from the token endpoint using the new grant type.</p><p>Push mode — the OP will post the full authentication result to the Client.</p><p>Open ID Specification define the main considerations with regard to the Client Initiated Backchannel Authentication (CIBA) and other specifications such as FAPI and OBIE inherits this specification with some modifications to cater their requirements.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e24e8ad2df33" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Supporting Non-Regulatory APIs through WSO2 Open Banking]]></title>
            <link>https://ashirwadadayarathne.medium.com/supporting-non-regulatory-apis-through-wso2-open-banking-6a42f8d1ad06?source=rss-57bc835d06d4------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a42f8d1ad06</guid>
            <category><![CDATA[open-banking]]></category>
            <category><![CDATA[non-regulatory-api]]></category>
            <category><![CDATA[open-banking-api]]></category>
            <category><![CDATA[wso2]]></category>
            <dc:creator><![CDATA[Ashirwada Dayarathne]]></dc:creator>
            <pubDate>Fri, 19 Jun 2020 11:31:15 GMT</pubDate>
            <atom:updated>2020-06-19T11:44:25.744Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vqau9ef6zpIp9GqwF_nRqQ.png" /></figure><p>Support to publish non-regulatory APIs which are used to deliver additional value to consumers, internal teams, employees and ecosystem partners like fintechs can now be deployed using the same WSO2 Open Banking technology stack. Similarly, non-regulatory applications can be created to access non-regulatory APIs using WSO2 Open Banking. Here, certain mandated security aspects of regulatory applications can be minimized as appropriate for the business use cases of the bank. For example, Bank APIs to get branch details and ATM details may be published using WSO2 Open Banking.</p><p>Accordingly, non-regulatory applications created using the platform are provided the capability of accessing these APIs without transport layer security. Similarly, grant types that are not allowed in regulatory applications such as passwords can be used in the case of non-regulatory applications. In essence, the platform now gives banks a lot more flexibility in designing use cases and user experiences around the APIs and applications they create and publish using WSO2 Open Banking.</p><h3>Deploying the Non-Regulatory API</h3><p>Non-Regulatory APIs are the APIs that do not bound to any regulations or standards. Depending on the API, one of the following methods can be used to deploy the API in WSO2 API Manager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bsb1sqCAUWJ_qHcW" /></figure><h3>Creating a Non-Regulatory Application</h3><p>After signing in to the store, users can create Non-Regulatory applications to access Non-Regulatory APIs. For Non-Regulatory Applications there are no restrictions on token type. User can select the preferred token type while creating the application. Following are the steps to create an application.</p><p>Go to the Applications tab after signing in to store. Then Click on Add Application and you will get the following UI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WSUJtFsSCNuEgEVw" /></figure><p>Add the name of the application, Per Token Quota and Description of the application. For Non-Regulatory applications the checkbox under Regulatory Compliance need to be unchecked. Once you uncheck the checkbox Token Type will be enabled for Non-Regulatory applications as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WSi2jWmZn1cLgPAA" /></figure><p>Then click Add to create the application.</p><h3>Generating Keys for Non-Regulatory Application</h3><p>After adding the application, it will be configured as a Non-Regulatory Application as following.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JHOY_HFCQEnlMh57" /></figure><p>For key generation add the redirect URL and click generate keys. All the grant types will be applicable to Non-Regulatory applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kr2UbFPDNkPFqJFI" /></figure><p>After generating the keys, below page will be displayed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FrSrsLle_lURvhIc" /></figure><h3>Token Generation using a Non-Regulatory Application</h3><ul><li><strong>Authorization Code Grant Type</strong></li></ul><p>Copy the following url in the browser to get the authorization code.</p><pre><em>https://localhost:9446/oauth2/authorize?response_type=code&amp;client_id=&lt;</em>client_id<em>&gt;&amp;redirect_uri=&lt;redirect_URL&gt;&amp;scope=openid</em></pre><p>Once you do that you will be redirected and you can find the code in the browser.</p><p>After that you can use the following curl command to get the access token.</p><pre><em>curl -k -v — user &lt;client_id&gt;:&lt;client_secret&gt; -d “grant_type=authorization_code&amp;code=&lt;authorization_code&gt;&amp;redirect_uri=&lt;redirect_URL&gt;” https://localhost:9446/oauth2/token</em></pre><ul><li><strong>Password Grant Type</strong></li></ul><pre>curl -u &lt;client_id&gt;:&lt;client_secret&gt; -k -d “grant_type=password&amp;username=&lt;username&gt;&amp;password=&lt;password&gt;” -H “Content-Type:application/x-www-form-urlencoded” <a href="https://localhost:9443/oauth2/token">https://localhost:9443/oauth2/token</a></pre><ul><li><strong>Refresh_token Grant Type</strong></li></ul><pre><em>curl -k -d “grant_type=refresh_token&amp;refresh_token=&lt;refresh_token&gt;” -H “Authorization: Basic &lt;Base64Encoded(Client_Id:Client_Secret)&gt;” -H “Content-Type: application/x-www-form-urlencoded”</em><a href="https://localhost:9443/oauth2/token"><em>https://localhost:9443/oauth2/token</em></a></pre><ul><li><strong>Client_Credentials Grant type</strong></li></ul><pre>curl -u &lt;client_id&gt;:&lt;client_secret&gt; -k -d “grant_type=client_credentials” -H “Content-Type:application/x-www-form-urlencoded”<a href="https://localhost:9443/oauth2/token"> https://localhost:9443/oauth2/token</a></pre><ul><li><strong>Implicit grant type</strong></li></ul><p>Token</p><p>Copy the following url in the browser to get the token.</p><pre>https://localhost:9446/oauth2/authorize?response_type=token&amp;client_id=&lt;client_id&gt;&amp;redirect_uri=<em>&lt;redirect_URL&gt;</em>&amp;scope=openid</pre><p>You can find the access token in the browser after redirecting.</p><p>ID Token</p><pre>https://localhost:9446/oauth2/authorize?response_type=id_token&amp;client_id=&lt;client_id&gt;&amp;scope=openid&amp;redirect_uri=<em>&lt;redirect_URL&gt;</em>&amp;nonce=13245</pre><p>You can find the id token in the browser after redirecting.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a42f8d1ad06" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Converting the Self Signed Certificate to a Trusted Certificate in MAC OS X]]></title>
            <link>https://ashirwadadayarathne.medium.com/converting-the-self-signed-certificate-to-a-trusted-certificate-in-mac-os-x-6172a42e3395?source=rss-57bc835d06d4------2</link>
            <guid isPermaLink="false">https://medium.com/p/6172a42e3395</guid>
            <category><![CDATA[trusted]]></category>
            <category><![CDATA[mac]]></category>
            <category><![CDATA[os-x]]></category>
            <category><![CDATA[trusted-certificate]]></category>
            <category><![CDATA[self-signed-certificate]]></category>
            <dc:creator><![CDATA[Ashirwada Dayarathne]]></dc:creator>
            <pubDate>Tue, 28 Apr 2020 06:07:10 GMT</pubDate>
            <atom:updated>2020-04-28T16:29:55.384Z</atom:updated>
            <content:encoded><![CDATA[<h3>Converting a Self Signed Certificate to a Trusted Certificate in MAC OS X</h3><p><strong>Self Signed Certificates</strong>, the name says what it is. In the domain of computer security certificates which are not signed by a certified authority are called Self Signed Certificates. Technically they are the certificates signed using its own private key.</p><p><strong>WHY Self Signed Certificates ???? </strong>Because they are easy to make and do not cost money.</p><p><strong>BUT </strong>Self Signed certificates do not contain the security properties that certificates signed by a CA aim to provide.</p><p>So today the topic is using Self Signed Certificates to provide HTTPS services by a website owner. People who visit the page will see a warning in the browser. Most of the time the website visitor bypass these warning and expose himself/herself to risk.</p><p>If you are using a MAC OS X and you want your browser to accept Self Signed Certificates here is the best way to do that.</p><ol><li>Locate where your certificate file is. It is likely to be somewhere near your web server configurations.</li><li>Open up Keychain Access. You can get to it from <em>Application/Utilities/Keychain Access.app.</em></li><li>Drag your certificate into Keychain Access.</li><li>Go into the Certificates section and locate the certificate you just added</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ogJK_KXVfRG_FMDLRrmfqw.png" /></figure><p>5. Double click on it, enter the trust section and under “When using this certificate” select “Always Trust”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QpgUQHqTeqXl4aaA" /></figure><p>Now when viewing your website locally your certificate will be trusted.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6172a42e3395" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Incremental Aggregation in WSO2 Siddhi for Data Summarization]]></title>
            <link>https://ashirwadadayarathne.medium.com/incremental-aggregation-in-wso2-siddhi-for-data-summarization-a28c7175a043?source=rss-57bc835d06d4------2</link>
            <guid isPermaLink="false">https://medium.com/p/a28c7175a043</guid>
            <dc:creator><![CDATA[Ashirwada Dayarathne]]></dc:creator>
            <pubDate>Wed, 29 Jan 2020 06:16:07 GMT</pubDate>
            <atom:updated>2020-01-29T06:27:15.492Z</atom:updated>
            <content:encoded><![CDATA[<p>Incremental aggregation in WSO2 Siddhi is a successful method to obtain aggregates in an incremental manner for a specified set of time periods. It allows to aggregate the data based on different time granularities and present them in various attractive ways by accessing those data. Also, the aggregated data can be further processed using the schemas which are defined in aggregation definition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*FHRZ_jCFGJYP-UOtyav_uw.png" /></figure><p>By using Incremental Aggregation, you can get the aggregates like sum, count, distinctCount, avg, min and max of the streams for different durations like seconds, minutes, hours, days, months and years. The syntax of the aggregation is as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V4QnGaGlpXhJ6QY5fbOCQw.png" /></figure><p>The usage of Incremental Aggregation will be explained via an example. For the aggregation to be executed an input stream should be defined. The input stream can be defined as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nB9_N6R7MbdcY62LQg1Lkw.png" /></figure><p>Let’s assume that we have a table with authentication data of a system. We have following data in the table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*OVaSrwfjbmFJp4am" /></figure><p>We want to calculate the number of authentications attempted per Authentication Approach per Request Type per User Agent where the AUTHENTICATION_STEP == ‘BasicAuthenticator’. First we have to retrieve the data from the raw table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jQhn4P3FHBFyizYveJWScA.png" /></figure><p>The aggregation can be defined as below to calculate the number of authentications attempted per Authentication Approach per Request Type per User Agent. The count is calculated per every time granularity in the second-year range.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*63MJLTwQgz1G9VCo00ecoQ.png" /></figure><p>So the full code to get the count using Incremental Aggregation in WSO2 Siddhi is given below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zi5wrnsiQ_KXi5HcqE1Rsg.png" /></figure><p>The above method can be used to get summation, distinct count, average, min and max as well by following the given steps.</p><p>This method is an easy way of summarizing data since it gives summaries at given time intervals.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a28c7175a043" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WSO2 Open Banking to Cater Open Banking and PSD2 Requirements]]></title>
            <link>https://ashirwadadayarathne.medium.com/wso2-open-banking-to-cater-open-banking-and-psd2-requirements-745f973e453b?source=rss-57bc835d06d4------2</link>
            <guid isPermaLink="false">https://medium.com/p/745f973e453b</guid>
            <category><![CDATA[open-banking]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[fintech]]></category>
            <dc:creator><![CDATA[Ashirwada Dayarathne]]></dc:creator>
            <pubDate>Tue, 22 Oct 2019 04:38:21 GMT</pubDate>
            <atom:updated>2019-10-28T05:16:27.702Z</atom:updated>
            <content:encoded><![CDATA[<p>Open Banking is one of the major turner in the financial sector where the financial data is made available by the banks to third parties via Open APIs. It practises sharing information via electronic medium securely under the approval of the customer. Security plays a major role in Open Banking as the access is given for very confidential data. Hence the banks must ensure that these confidential data is not handed over to the wrong parties by ensuring security via extra steps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*-wLKZRs3LBkWxnl9rx36Ng.png" /></figure><p>The concept came out with the revision of Payment Services Directive also known as PSD2 which aims at regulating payment services and payment service providers throughout the European Union. The revision was aimed at promoting the use of online and mobile payments through open banking, for that banks must let the customers share their financial data, such as spending habits, regular payments and bank products used such as credit card or savings statements with other authorised providers.</p><h3>Open Banking with PSD2</h3><p>As explained above PSD2 gives the right to the Open Banking concept to allow the bank customers to use third parties to manage their finance. To adhere to the concept and rules, banks must expose their data via APIs under the XS2A (access to account) rule. So that the third parties who will be adhering to PSD2, can access these APIs and provide services to the banking customers. The banks have a responsibility to identify and select the best Open Banking solution that provide the requirements of PSD2 to ensure their customer trust is not at risk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o-EQRDeUohBqQkFFqUwbfQ.jpeg" /></figure><h3>Third Party Providers (TPPs)</h3><p>PSD2 encourages new players to the entire financial market and provide better services to banking customers. Third Party Providers are the authorized parties to access the financial data via the APIs.</p><p>TPPs can take ownership of the transaction entirely after getting the approval by the customer.</p><p>Third Party Providers can be of one or combination of following.</p><ul><li>PISP (Payment Initiation Service providers)</li></ul><p>The PISP gets the approval from the customer and initiates a credit transfer from the specified account to the given account on behalf of the bank’s customer</p><ul><li>AISP (Account Information Service Providers)</li></ul><p>The AISP provide the details of the transactions and balances of the provided accounts from different banks under the approval of the customer.</p><ul><li>PIISP/CBPII (Card Based Payment Instrument Issuer)</li></ul><p>The CBPII issues cards used as payment instruments to initiate a payment transaction between the bank and the beneficiary account.</p><h3>The role of WSO2 Open Banking</h3><p>WSO2 Open Banking is a complete solution that provides all the technological requirements to fulfil an Open Banking platform for banks. WSO2’s API management, security and integration capabilities are embedded into WSO2 Open Banking to provide a PSD2 compliance solution with the ability to scale for different deployment patterns. WSO2 Open Banking have achieved their compliance by offering;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*VfQM8Xuuhxq_tw8OAtHTkw.png" /></figure><ul><li>Secured platform via OAuth2, OpenID and Certificate validation</li><li>Ability to support different API specifications like Open Banking UK, Berlin Group Consumer Data Rights and STET Specification etc.</li><li>Extended security for authentication and authorization inline with the Regulatory Technical Standards (RTS) like Strong Customer Authentication, Transaction Risk Analysis and Fraud Detection etc.</li><li>Ease to plug to the core banking system</li><li>API Analytics and Data Reporting to meet the PSD2 requirements for reporting</li></ul><p>With the use of WSO2 Open Banking, banks can expose their APIs for core banking system securely and allow the TPPs to onboard to their core banking system. After onboarding trusted TPPs can access the financial data in the core banking system via the APIs and provide the data to the bank customers more securely and attractively.</p><p>For more information about WSO2 Open Banking breeze into <a href="https://openbanking.wso2.com/">openbanking.wso2.com</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=745f973e453b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>