<?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 Rodrigo Yanis on Medium]]></title>
        <description><![CDATA[Stories by Rodrigo Yanis on Medium]]></description>
        <link>https://medium.com/@rodyan?source=rss-dce9213859b8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ROLjmikyItcvhxhTwiMQ0w.png</url>
            <title>Stories by Rodrigo Yanis on Medium</title>
            <link>https://medium.com/@rodyan?source=rss-dce9213859b8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 17:32:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rodyan/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[Implementing a custom JIT provisioning handler in WSO2’s Identity Server]]></title>
            <link>https://rodyan.medium.com/implementing-a-custom-jit-provisioning-handler-in-wso2s-identity-server-ed8b70a061a7?source=rss-dce9213859b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed8b70a061a7</guid>
            <category><![CDATA[identity-management]]></category>
            <category><![CDATA[custom]]></category>
            <category><![CDATA[provisioning]]></category>
            <category><![CDATA[jit]]></category>
            <category><![CDATA[wso2]]></category>
            <dc:creator><![CDATA[Rodrigo Yanis]]></dc:creator>
            <pubDate>Wed, 24 Mar 2021 18:20:02 GMT</pubDate>
            <atom:updated>2021-03-24T18:39:41.192Z</atom:updated>
            <content:encoded><![CDATA[<p>WSO2’s Identity Server offers a wide range of customization options in terms of enabling users and administrators to add custom business logic to different stages of authentication and provisioning use cases. In this post I’ll be explaining how to fully implement and enable a custom JIT provisioning handler in WSO2’s Identity Server product.</p><p>This solution has been modelled for, and tested on WSO2’s Identity Server version 5.11.0. If you’re planning on doing this for a different IS version, bare in mind that there could be some differences with what you’ll read on this post.</p><h4>Context</h4><p>To start off with, let’s go through some basic contextual concepts that might already be familiar to you, the reader. If that is the case, feel free to skip this part and go straight to the <a href="#8bae"><em>Implementation</em></a><em> </em>segment of this post.</p><p><em>What is JIT provisioning and what use cases does it help tackle?</em></p><p>In short, “Just In Time” provisioning is an automated mechanism that allows for user creation, update, or other user-provisioning related operations, in authentication time. What this means is, whenever a JIT provisioning handler is implemented in WSO2’s Identity Server, custom logic can be added and automatically triggered whenever a user performs an authentication attempt through any pre-configured inbound authentication rules on the Identity Provider side.</p><p>This facilitates and diversifies the tools for creating or modifying a local user instance on the Identity Server’s user store, as it couples and links up authentication and provisioning processes under a controlled set of rules.</p><p>In line with this, IT administrators and developers can delegate and automate the execution of specific instructions that need to be followed for user creation, claim modification, and/or role/group provisioning processes.</p><p><em>What tools do I need as a developer to implement a custom JIT provisioning handler in WSO2’s Identity Server?</em></p><p>To get hands-on into writing and implementing your own JIT provisioning handler, you’ll need a basic understanding of Java language, an IDE of your preference (with Maven plugins support), as well as write access to the filesystem of your relevant WSO2’s Identity Server instance.</p><p>In this guide, I’ll be opting for IntelliJ IDEA as my IDE of preference.</p><h4>Implementation</h4><p>For simplicity’s sake, in this particular sample, we’re going to write a custom JIT handler that seeks to comply with the following mock business requirement:</p><blockquote>Whenever a user attempts to log-in to a business application that has WSO2’s Identity Server configured as its main Identity Provider, it is needed that this user is first created as a new user on the Identity Server side. This also implies adding the “Default User Role” role to the user. If the user already existed on the Identity Server, and upon validation, it shows that its Email attribute hasn’t been yet set, the component should automatically generate and populate the Email attribute in accordance with the following syntactic rule: “{username}@mycompany.com”</blockquote><p>Proceeding with the practical implementation, generate a new Maven project in your local machine. You can use any default Maven archetype to accomplish this. You can pick whatever project name you think it’s appropriate and relatable to the nature of the component — bare this in mind if you’re planning on adding this artefact to your SCM model.</p><p>The project will consist, at the bare minimum, of two Java classes. The internal OSGi registration class will serve as an internal framework reference for activating this custom component in your local Identity Server instance. The handler class, on the other hand, will serve as the main entry point for all business logic that you want to put in place for the JIT handler to execute.</p><p>Reproduce the following basic project structure;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*KblAzSxI5MDbQ7IhcmGuAQ.png" /><figcaption>Image 1: Primitive custom JIT provisioning handler project structure</figcaption></figure><p>This is what it should be looking like on the IDE side. I chose to name my project “<em>custom-jit-provisioning-handler</em>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*UMCn-FWJXBx2lGBIbv8h5Q.png" /><figcaption>Image 2: Primitive custom JIT provisioning handler project structure on the IDE side (IntelliJ IDEA)</figcaption></figure><p>The <em>pom.xml</em> file should look like this:</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;<br>         xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<br>         xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;<br>    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;<br><br>    &lt;parent&gt;<br>        &lt;groupId&gt;org.wso2&lt;/groupId&gt;<br>        &lt;artifactId&gt;wso2&lt;/artifactId&gt;<br>        &lt;version&gt;1.2&lt;/version&gt;<br>    &lt;/parent&gt;<br><br>    &lt;groupId&gt;com.mycompany.wso2.carbon.identity.jit.provisioning.handler&lt;/groupId&gt;<br>    &lt;artifactId&gt;com.mycompany.wso2.carbon.identity.jit.provisioning.handler&lt;/artifactId&gt;<br>    &lt;version&gt;1.0.0&lt;/version&gt;<br>    &lt;packaging&gt;jar&lt;/packaging&gt;<br><br>    &lt;dependencies&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;org.wso2.carbon.identity.framework&lt;/groupId&gt;<br>            &lt;artifactId&gt;org.wso2.carbon.identity.application.authentication.framework&lt;/artifactId&gt;<br>            &lt;version&gt;${carbon.identity.framework.version}&lt;/version&gt;<br>        &lt;/dependency&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;org.wso2.carbon.identity.framework&lt;/groupId&gt;<br>            &lt;artifactId&gt;org.wso2.carbon.identity.application.mgt&lt;/artifactId&gt;<br>            &lt;version&gt;${carbon.identity.framework.version}&lt;/version&gt;<br>        &lt;/dependency&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;org.apache.felix&lt;/groupId&gt;<br>            &lt;artifactId&gt;org.apache.felix.scr.ds-annotations&lt;/artifactId&gt;<br>            &lt;version&gt;${ds-annotations.version}&lt;/version&gt;<br>        &lt;/dependency&gt;<br>    &lt;/dependencies&gt;<br><br>    &lt;build&gt;<br>        &lt;plugins&gt;<br>            &lt;plugin&gt;<br>                &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;<br>                &lt;version&gt;2.3.1&lt;/version&gt;<br>                &lt;inherited&gt;true&lt;/inherited&gt;<br>                &lt;configuration&gt;<br>                    &lt;encoding&gt;UTF-8&lt;/encoding&gt;<br>                    &lt;source&gt;1.8&lt;/source&gt;<br>                    &lt;target&gt;1.8&lt;/target&gt;<br>                &lt;/configuration&gt;<br>            &lt;/plugin&gt;<br>        &lt;/plugins&gt;<br>    &lt;/build&gt;<br><br>    &lt;properties&gt;<br>        &lt;carbon.identity.framework.version&gt;5.18.187&lt;/carbon.identity.framework.version&gt;<br>        &lt;ds-annotations.version&gt;1.2.10&lt;/ds-annotations.version&gt;<br>    &lt;/properties&gt;<br>&lt;/project&gt;</pre><p>The <em>internal/CustomJITProvisioningHandlerOSGIBundleManager</em> class will consist, at the very minimum, of an <em>activate </em>method in which the bundle’s registration will take place.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Yv1rvdHnxpovk99XxQ02Q.png" /><figcaption>Image 3: Contents of <em>internal/CustomJITProvisioningHandlerOSGIBundleManager class</em></figcaption></figure><p>As previously mentioned, the CustomJITProvisioningHandler class will implement the core logic that needs to be executed before continuing with the default JIT provisioning flow. In that regard, it is needed to either extend the <em>DefaultProvisioningHandler</em> class, or implement the <em>ProvisioningHandler</em> interface. I’ve opted for the first approach in this sample.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bdd3vaWz_XK189nUBkmCpg.png" /><figcaption>Image 4: Contents of <em>CustomJITProvisioningHandler class</em></figcaption></figure><p>As you might have noticed, all business logic was implemented in the context of the <em>handle </em>method. While there’s no problem with this, I strongly suggest you consider distributing functional object responsibility appropriately, depending on your particular scenario, to maintain cohesiveness as high as you can.</p><p>Once you’ve finished writing your custom handler, perform a build of the project by executing the following Maven instruction on the project’s root.</p><pre>mvn clean install</pre><p>This will generate a deliverable JAR file on the target directory. Copy this file and place it into the <em>dropins</em> folder of your WSO2’s Identity Server instance. You can find it in the following path:</p><pre>$IS_HOME/repository/components/dropins</pre><p>Once you’ve copied the deliverable, browse back to the &lt;<em>$IS_HOME/repository/conf&gt;</em> directory. In there, you’ll find the <em>deployment.toml</em> file. Edit it by appending the following configuration entry:</p><pre>[authentication.framework.extensions]<br>provisioning_handler=&quot;com.mycompany.wso2.carbon.identity.jit.provisioning.handler.CustomJITProvisioningHandler&quot;</pre><p>Save the file, and perform a restart of your WSO2’s Identity Server instance.</p><p>This concludes the process of implementing your custom JIT provisioning handler into your local WSO2’s Identity Server instance.</p><h4>Additional references</h4><p>You can check out the code for this sample from my GitHub repository <a href="https://github.com/Rod-yan/custom-jit-provisioning-handler">here</a>.</p><p>Please, feel free to reach out to me for any suggestions or inquiries you might have.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed8b70a061a7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>