<?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 Nirabhra Tapaswi on Medium]]></title>
        <description><![CDATA[Stories by Nirabhra Tapaswi on Medium]]></description>
        <link>https://medium.com/@nirabhratapaswi?source=rss-d6fafd26e9d2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Nirabhra Tapaswi on Medium</title>
            <link>https://medium.com/@nirabhratapaswi?source=rss-d6fafd26e9d2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 19:43:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nirabhratapaswi/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[What is Keycloak? How to use it — an example with nodejs? (Part 1)]]></title>
            <link>https://medium.com/theoptimaltechnologist/what-is-keycloak-how-to-use-it-an-example-with-nodejs-part-1-25434e963fed?source=rss-d6fafd26e9d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/25434e963fed</guid>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[keycloak]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Nirabhra Tapaswi]]></dc:creator>
            <pubDate>Sun, 13 Sep 2020 20:06:07 GMT</pubDate>
            <atom:updated>2020-09-14T14:43:01.301Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Keycloak? How to use it — an example with nodejs? (Part 1)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/1*vnXae8d0IpVQ6Loau5ksaA.png" /><figcaption><a href="https://www.keycloak.org/">Keycloak</a></figcaption></figure><p>As our world evolves towards getting more and more digital, our digital identities become more and more important, and with it, the means to verify them accurately.</p><p>What this means for software products is that they have to manage user identification and</p><p>access securely and concretely. But this isn’t easy right? I mean, as a business product manager, you would want to focus more on feature development and intrinsic value addition rather than solving already solved problems, as a friend once told me. I didn’t quite agree then, but eventually you should recognize the work done by others and welcome their ideas and work rather than always building everything from scratch.</p><p>On a similar note, I would say that building a native Identity Management and Access Control solution may seem intriguing, but if you have other important areas to work on, leave this to the pros — Keycloak.</p><p><strong>Keycloak</strong> is an Identity and Access Management(IAM) Software, which will act as an essential tool in your business product. IAM typically aims to verify the identity of a user or system which is requesting access to your environment, and evaluates a set of rules which tells what features and assets is that user/system has access to. The identity management and access management are two different entities. In classical situations, access management relies on an Identity Provider to verify the user, and builds on top of it to map the identity of the user/system with what it can do in an environment. Typically Role Based Access Control(RBAC) is a standard concept that is followed to establish an access control layer. A support layer is added to make use of this access management, basically a set of protocols to use this with other applications. Usually the protocol ends up being OAuth, which is a standard responsible for managing the access control parameters on the Authorization software side, as well as lay the guidelines to be followed by the applications utilizing the Authorization service.</p><p>If you wish to know more about IAM, you can refer to the following article, or other articles online:</p><p><a href="https://www.csoonline.com/article/2120384/what-is-iam-identity-and-access-management-explained.html">What is IAM? Identity and access management explained</a></p><p>I will move on to explain where Keycloak fits into the picture. Keycloak combines the power of a Identity Provider and a Authorization Server to give a foolproof IAM solution to us. Also it has out of the box integrations with social logins sites, other identity providers, as well as federate external user databases like LDAP servers. Keycloak thus seems like a software that we would want to use to reduce our IAM overhead.</p><h4>Installation</h4><p>Before we delve into the using Keycloak, I should tell you how to set it up quickly. I will suggest a docker installation available in your local, and we can use the docker image for keycloak easily.</p><pre>$ docker run -p 8080:8080 -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin quay.io/keycloak/keycloak:latest</pre><p><a href="https://www.keycloak.org/getting-started/getting-started-docker">Docker</a></p><p>There are other ways to set it up, visit <a href="https://www.keycloak.org/docs/latest/getting_started/index.html">Keycloak’s Getting Started Guide</a>.</p><p>After the server is up and running, you can open the browser at <a href="http://192.168.0.110:8080/auth/">http://127.0.0.1:8080/auth/</a> and click on Administration Console, which should redirect you to <a href="http://192.168.0.110:8080/auth/admin/master/console/">http://127.0.0.1:8080/auth/admin/master/console/</a>. Log in to the master console with username password that you provided above(admin, admin for me).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VCq4kNW_ndIrrsCEfjNQgQ.png" /><figcaption>Master Login</figcaption></figure><p>After we login, we can see the following page —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X4KVVVhkk670OExxcd5oGg.png" /><figcaption>Master Console</figcaption></figure><p>Let me explain what a realm is before we proceed. Keycloak tells us to think of a realm as an equivalent of a tenant. This can also be thought of as a namespace(if you are familiar with networks).</p><h4>Realm Creation</h4><p>Hover on the Master(realm) in the top right and select Add Realm. Here we create our new realm which is dedicated to the product that we are building-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JgVvFF08DxqHsLCy-A0Jlw.png" /><figcaption>Create Realm</figcaption></figure><p>Click on the create button and you should see the realm’s home page —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zTd84KWUZQzLypUSPqXejA.png" /><figcaption>Realm Home</figcaption></figure><p>Let me explain the side menu bar’s configure section quickly.</p><ul><li>Settings is to tune the realm settings like token expiry, themes, cache etc.</li><li>Clients is an important tab, and is used to create clients which represent the applications that we build for our product.</li><li>Client scopes are common scopes that clients can use. Scopes are entities that help the clients(applications) in their decision to grant or deny access to it’s resources(assets).</li><li>Roles are common set of classification which help majorly in granting access to certain applications’ assets. These can be used commonly across all the clients.</li><li>Identity Providers leverages the ability of external identity management systems to authenticate.</li><li>User Federation is to integrate Keycloak’s identity database with external User Databases like ldap servers.</li><li>Authentication is to control Keycloak’s default authentication/ authorization behavior. For most of the cases you won’t need to tweak this, as it is a slightly advanced feature for real fine tuning purposes.</li></ul><p>The manage section is fairly intuitive, where you can create and manage users, groups and sessions; and do imports and exports of settings. Events tab is to check the admin and user logs(like logins, changes etc) and add plugins that you write for Keycloak.</p><h4>Sample Application with Nodejs</h4><blockquote><strong><em>Keycloak configuration</em></strong></blockquote><p>Now that we are ready with our basic Keycloak console, let us build a basic application to feel this whole thing in action. Before we start with our nodejs code, let us complete our Keycloak setup.</p><p>First, let us create 2 roles, user and admin. Select the roles tab, and click on add role button —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ewK6WzigWZgBQekw_IyHIw.png" /><figcaption>Role Create</figcaption></figure><p>Create admin in the same way(name it “admin” exactly for the purpose of this tutorial).</p><p>Now let us create an user. Go to users tab and click on add user button —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6gQuPE4v9gUQm3F7yGMPzw.png" /><figcaption>User create</figcaption></figure><p>Now we set his password(credentials), by clicking on the credentials tab —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zp10MmRuLDo07hAJTiTJKQ.png" /><figcaption>User Credential</figcaption></figure><p>We now move on to assigning a role to our user, click on Role Mappings tab —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VLawSQJhpG6bN0vfnFGL6g.png" /><figcaption>User Add Role</figcaption></figure><p>Note that the roles we had earlier created is displayed here. Click on add selected to actually add the highlighted role(don’t add the admin role, we will want to see a denial of service due to the lack of this role for this user).</p><p>Now that we are ready with our user and have assigned him his role, lets move on to creating a client for our nodejs application(which we will code in a bit). Go to Clients tab and click on Create button —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f6ua7L6PcY8CJmpjLt1obw.png" /><figcaption>Client Create</figcaption></figure><p>Additionally, let us edit some properties of this client after its created —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jy3dMkYuTeIA_E2AekIF5g.png" /><figcaption>Client Edit</figcaption></figure><p>I would like to emphasize on the access type selection here. Notice that we changed the default(which is public) to confidential type. A brief overview of the types:-</p><ul><li><strong>Public client</strong>: When we cannot transmit client secrets over the channel to the application. For example in the case of browsers and mobile applications. Because each instance of a browser tab of mobile application is different and, and is almost always over public internet, we cannot pass a secret to them; and also there is a issue of trust, because the end user can have access to the secret if transmitted to his/her application(browser/ mobile etc).</li><li><strong>Bearer-only client</strong>: When we want our backend application to simple verify the token and get details on the scopes of the issued token, not have a fine grained access control on the particular application. Doesn’t have any resources(assets) associated to it.</li><li><strong>Confidential client</strong>: When we want a fine grained access control feature enabled by the keycloak server on the client application(running in the backend). Has resources(assets) associated to it.</li></ul><p>There are two important <em>distinguishing factors</em>, or say two categorizations between these 3 client types. First is <em>public clients</em> are used for user-end devices and not servers whereas the other two are used more often for backend services(servers side applications). The other important categorization is the ability of <em>confidential clients</em> to <em>register resources</em> on which it can perform <em>fine grained access control</em> using scopes, policies and permissions(its a really very powerful feature); this feature is not available for public and bearer-only clients.</p><p>Now that we understand these types, we will resume creation of our client with confidential type, and authorization enabled(service account is auto enabled with this). Enabling authorization actually enables us to define and use the fine grained access control that I mentioned. Save the client configuration, and you will see Authorization tab enabled at the top. Click on it, you will see the following —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NUacy8jLT60AlNzvstOk_g.png" /><figcaption>Authorization Home</figcaption></figure><p>Let me explain the function of each of the sub top navigation tabs of Authorization before me move ahead —</p><ul><li><strong>Resources</strong>: Manage resources, i.e. assets, of the application. This is the abstraction of the actual assets that the application(whose client this is) consists.</li><li><strong>Authorization Scopes</strong>: These are resource specific scopes that we can define to become part of our access control. This differs from the common Client Scopes which we saw earlier in the sense that these scopes hold meaning only in the context of this particular application’s resources, and not others. For example if we have 2 clients: client-1 with resource-1 and client-2 with resource-2; a scope say “read” would hold different meaning in the case of resource-1 and resource-2, based on how that application is actually written.</li><li><strong>Policies</strong>: These are the actual conditions that must be satisfied to return a permit object.</li><li><strong>Permissions</strong>: These bind policies to whole resources or specific scopes, to represent a wholesome permit/deny evaluation. This means that it links a policy(<em>which is essentially a boolean logic</em>) to an asset(or a part of it), providing the ultimate fine grained control that we spoke about.</li></ul><p>Now that we have a brief understanding of what Authorization is all about, let us create a authorization configuration for the application that we are building. Click on Authorization Scopes and then click create —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AF8nvk24BDWekNz2f71Jug.png" /><figcaption>Authorization Scope Create</figcaption></figure><p>Similarly create a write scope(ensure it’s name is exactly “write” for the sake of our tutorial). Now click on Resources tab and click on create —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KhnasQO42o81W_pE5P6xyQ.png" /><figcaption>Resource Create</figcaption></figure><p>Notice that we are associating read and write scope to this resource. Now click on Policies, click on Create Policy and select Role in the dropdown —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZagFOxSVkcr_EUPOrriSjQ.png" /><figcaption>Policy Create(Read)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GDAY_p8Iv_ADZyKmJosQQA.png" /><figcaption>Policy Create(Write)</figcaption></figure><p>Notice that we are associating different realm roles to these policies, defining our logic of grant evaluation.</p><p>Lastly, lets link these Resources, scopes and policies together! Click on Permissions tab and click on Create Permission and select Scope-Based from the dropdown —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kxq5OxZVg844cBsf4cdk_A.png" /><figcaption>Permission Create(Read)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VJbwNAbCf_valWMhf5ki3Q.png" /><figcaption>Permission Create(Write)</figcaption></figure><p>Notice how we bind a resource, its scope and the desired policy to create a permission, which becomes our evaluation logic for granting access.</p><p>Before we finish, let us test the configuration we made so far. Yes it can be done via the UI! Isn’t it great? Click on Evaulate tab, selecting the client, user and resource, scope and then clicking evaluate results in —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d2FWsPcU7C7cEH3AucG8iA.png" /><figcaption>Evaulate(Permit Example)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TyhIBqCXV5a2zDjbPezEmw.png" /><figcaption>Evaulate(Permit Result)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K7_Re80iox3qwD_bhBiO_w.png" /><figcaption>Evaulate(Deny Example)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f39ldAQBGyytunLCaSxycg.png" /><figcaption>Evaulate(Deny Result)</figcaption></figure><p>We have reached the end of this article, and to continue with our tutorial of building our nodejs application, I will continue onto the next article of this series(Part 2). Thankyou for reading this far, hold on a bit longer to see all this hard work and concepts crunching bear fruits.</p><p>Continue reading Part 2 —</p><p><a href="https://medium.com/theoptimaltechnologist/what-is-keycloak-how-to-use-it-an-example-with-nodejs-part-2-46b562e2b46c">What is Keycloak? How to use it — an example with nodejs? (Part 2)</a></p><p>Read more on the how to use Keycloak in a production environment with multiple microservices here (from the author of this series) —</p><p><a href="https://medium.com/@nirabhratapaswi/keycloak-for-securing-enterprise-applications-an-overview-fa99e5d0ab93">Keycloak for securing enterprise applications — an overview</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=25434e963fed" width="1" height="1" alt=""><hr><p><a href="https://medium.com/theoptimaltechnologist/what-is-keycloak-how-to-use-it-an-example-with-nodejs-part-1-25434e963fed">What is Keycloak? How to use it — an example with nodejs? (Part 1)</a> was originally published in <a href="https://medium.com/theoptimaltechnologist">theoptimaltechnologist</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Keycloak? How to use it — an example with nodejs? (Part 2)]]></title>
            <link>https://medium.com/theoptimaltechnologist/what-is-keycloak-how-to-use-it-an-example-with-nodejs-part-2-46b562e2b46c?source=rss-d6fafd26e9d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/46b562e2b46c</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[keycloak]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[expressjs]]></category>
            <dc:creator><![CDATA[Nirabhra Tapaswi]]></dc:creator>
            <pubDate>Sun, 13 Sep 2020 20:02:49 GMT</pubDate>
            <atom:updated>2020-09-14T11:38:30.514Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>What is Keycloak? How to use it — an example with nodejs? (Part 2)</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jw9V__6jYhm2amP74D_0lw.png" /></figure><p>Welcome back to our two part series on configuring and using <strong>Keycloak</strong> in real world. In this part I will focus more on using the Keycloak setup that we configured back in Part 1 in a <strong>nodejs express</strong> application.</p><p>Now, I have been with javascript for a long time, since I was introduced to web development, which is the reason I found it easy to integrate with a nodejs application. On the other side, there are lots of easy to use Java adapters(framework specific) that you will find <a href="https://www.keycloak.org/docs/latest/securing_apps/#openid-connect-3">here </a>—</p><p><a href="https://www.keycloak.org/docs/latest/securing_apps/#openid-connect-3">Securing Applications and Services Guide</a></p><p>And for other programming languages, there are unofficial libraries that provide easy integration with basic Keycloak features, but I would recommend using <a href="https://www.keycloak.org/docs/latest/securing_apps/#_keycloak_generic_adapter">Keycloak Gatekeeper</a> —</p><p><a href="https://www.keycloak.org/docs/latest/securing_apps/#_keycloak_generic_adapter">Securing Applications and Services Guide</a></p><p>Also, its fairly easy to implement the apis of Keycloak and develop a custom keycloak service in any programming language. I shall create a api tutorial later for ease of integration with other programming languages or bash via http(s) protocol. Just remember, with increasing proficiency in programming languages and technology concepts, your dependency on external libraries decreases as you understand implementation specifics better. Not that using libraries are bad(as I mentioned before, don’t reinvent unless necessary), but if the 3rd party libraries with unreliable maintainers, better rewrite it so that improvements on it become easy.</p><p>Okay, enough talk, lets start building our nodejs express application. First of all, you will need nodejs and npm installed in your system. Firstly, create a folder to work on, and run a few getting ready commands —</p><pre>$ mkdir keycloak-express<br>$ cd keycloak-express<br>$ npm init<br>$ npm install express ejs express-session keycloak-connect serve-favicon --save</pre><p>The directory structure will finally look like —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*4e0A4Bo2lv6pvF2lJRgTKA.png" /><figcaption>directory structure</figcaption></figure><p>We will get to know all of these during the tutorial, lets begin with index.js. It is the entry-point to our expressjs server. We will be using ejs(embedded javascript) format for html embedded javascript coding(ejs its an old pattern but its quite easy to use and feels just like javascript).</p><p>Lets begin with writing the basic express server code —</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/72a09ba7f2439dfc117aeae51faca686/href">https://medium.com/media/72a09ba7f2439dfc117aeae51faca686/href</a></iframe><p>I won’t be explaining in depth the express framework or how nodejs http server works, that is out out of the scope of this article, but only some logical parts of the code which is necessary for understanding. Observe that we have two GET routes at paths “/” and “/home” respectively. Our ultimate goal will be to show an authenticated user the home page with his name and some details on this screen. Lets look at the initial version of our home.ejs(think of it like html only, with abilities to include javascript within it). This is how home.ejs should look like —</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8da5f022430b7ade540a1708172ea673/href">https://medium.com/media/8da5f022430b7ade540a1708172ea673/href</a></iframe><p>In the home.ejs file, we are simply checking for the presence of a user object, and in case it is absent, we want the user to login. We have not yet included the login logic yet. You can run the server at this point —</p><pre># node index.js</pre><p>Visit <a href="http://127.0.0.1:3000/home">http://127.0.0.1:3000/home</a> to see the name ‘John’ being printed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xOca7LLFhkKdfeAqMQxLrw.png" /><figcaption>Browser</figcaption></figure><p>Well, that is not impressive.. But have a bit of patience, we will get to the awesome parts. Before we proceed, let us get the client adapter configuration file from Keycloak. Go to the client(my-product), click on Installation tab and select <strong>Keycloak OIDC JSON</strong> option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ldwgc59I3z-gatiNtML0dA.png" /><figcaption>keycloak.json</figcaption></figure><p>Save this as keycloak.json adjacent to our index.js server file(refer directory structure).</p><p>Before we proceed to introduce keycloak code for our express app, I would like to briefly tell you about the tokens that Keycloak returns when logging in a user —</p><ul><li><strong>Access Token</strong>: Contains claims about the user and it’s roles, permissions, groups etc. This is the actual token which is evaluated for granting access to protected resources.</li><li><strong>Refresh Token</strong>: Think of it as a session token(Keycloak does). This token is responsible to issuing new access tokens(which are short lived by convention) till this itself expires, which will lead to a re-login scenario.</li><li><strong>ID Token</strong>: This is a token containing claims about the user’s details. By default it has the same amount of user’s details claims as the access token, but as new user details are added, ID Token is supposed to have them by convention.</li></ul><p>Lets edit our index.js file to include keycloak login and authentication functions —</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e67779f9fc6eb4e68514534b5aefbc02/href">https://medium.com/media/e67779f9fc6eb4e68514534b5aefbc02/href</a></iframe><p>Let us go over this file, firstly, we import keycloak-connect, which is our keycloak client adapter. Then we initialize a memory store(memoryStore), which is used by keycloak-connect for internal token caching. Finally, what we are interested is in the middlewares introduced in routes “/home” and “/login”. This route internally redirects the user to Keycloak’s <em>my-product</em> realm’s login page, with a redirect to the the actual url that we requested(in this case “http://127.0.0.1:3000/login” or “http://127.0.0.1:3000/home” whichever we called first. The keycloak.protect() function makes sure we have a valid token from Keycloak before we access the actual function backing that route. Note, here “/login” is just a formality for frontend convenience, as keycloak.protect() would redirect unauthenticated requests to any of “/login” or “/home” to “<em>my-product</em>” login page. Before we go ahead and change our home.ejs template, lets try this new piece of code out. Restart the server with ctrl + c and running ($ node index.js) again(explore nodemon or yarn tools for auto-restarting servers). Open <a href="http://127.0.0.1:3000/login">http://127.0.0.1:3000/login</a>, we immidiately get redirected to Keycloak’s “my-product” realm, enter credentials and see if the outputs match —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2m_LUaH43vwKUeiFUU6BWg.png" /><figcaption>my-product login</figcaption></figure><blockquote>NOTE: My keycloak is hosted on a different server in my network, not my localhost hence the URL is what you see above, it should come 127.0.0.1/localhost for you if you have installed it in the same machine.</blockquote><p>Now, after this you would ideally expect to get logged in, and see the home.ejs page from earlier(because if you see index.js login route function, we see redirect to home on successful login). Lets see what we get —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z_H56295uue7Px09sBg99Q.png" /><figcaption>access denied</figcaption></figure><p>If you are quite new to Keycloak, by this time you will be confused. Don’t worry it is expected. Are you wondering where we went wrong? Maybe the nodejs code? Or some Keycloak configuration? Afterall we have gone through alot of setup, something may have gone wrong. But the real reason is a very useful security concept that Keycloak implements called audience checking. Refer to the following article for in-depth clarity —</p><p><a href="https://www.keycloak.org/docs/latest/server_admin/#_audience">Server Administration Guide</a></p><p>The overall idea is that the way clients verify tokens is configurable to include audience verification. This mitigates the possibility of unwanted access to applications even with correct roles(such as unintended server to server communication). The tokens will be evaulated to deny if the it does not have that particular client as an audience. In our case, we have to add a scope to our “my-application” client which adds itself as an intended audience when undergoing a login process. Read more about protocol-mappers, scopes and claims on the official <a href="https://www.keycloak.org/">Keycloak website</a> to understand these very important concepts in depth.</p><p>Navigate to the Client Scopes page in Keycloak, click on Create button and add a new client scope “my-application-scope” —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BThgmMeDkDgbScEXJj0CRw.png" /><figcaption>Client Scope Create</figcaption></figure><p>Then select Mappers from the tab bar, click on Create button, and create a mapper with name “my-application-audience-protocol-mapper” —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gmUy5xS5QItVM6skjYC1fQ.png" /><figcaption>Audience Protocol Mapper Create</figcaption></figure><p>In the above select Mapper Type Audience, so that Keycloak knows in which field of the encoded tokens to add the audience values. You can disable add to ID token switch if you want, I am just going to leave it as it is. Lastly go to Clients page, select “my-application”, click on Client Scopes, and add this newly added client scope to it —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iitG2oe5o3l8s8WhmMCLVQ.png" /><figcaption>Client Scopes Add</figcaption></figure><p>Now we are ready to test our nodejs code again. First hit “http://127.0.0.1:3000/logout” to clear the current session token with no audience parameters. Then go to “http://127.0.0.1:3000/login” again and login to Keycloak’s login page. Now you should see the following page after a successful login —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DF7Ie3Z5nvmN5LUWcAkUag.png" /><figcaption>audience verify success, login success</figcaption></figure><p>We have accomplished a major feat with Keycloak and nodejs. But we still have a few features to test out. We have logged in yes, and our routes are authentication protected, but what about authorization? Remember that we already have an authorization framework ready in our Keycloak(and we already tested it with Evaluate tab in Authorization under Client). Lets edit our code to look at how we can protect some routes to specifically demand permissions. Here is our final index.js —</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e44dcec01d6124d7a5d8ac365850a3c7/href">https://medium.com/media/e44dcec01d6124d7a5d8ac365850a3c7/href</a></iframe><p>We have added 2 additional routes(GET “/asset01”, GET “/asset01/update”) to showcase the authorization check feature of Keycloak. Ideally the second route, i.e. “asset01/update” should have been a POST request, but here we are using GET route because it simplifies our frontend request from UI. You can see in the <strong>keycloak.enforcer</strong> middleware funtion that the resource and scope are passed as a “:” concatenated string(a demand of the library, not keycloak itself). This ensures whatever function lies at the end of the route path is accessed by only users with the required scope access on the resource. In our case, our “/asset01” endpoint requires a <strong>read</strong> scope permission on <strong>asset-01</strong> resource, and “/asset01/update” endpoint requires a <strong>write</strong> scope permission on <strong>asset-01</strong> resource. If you remember, we had granted our user John Halpert a user role, which we saw in our permissions tab that is allowed to access only the <strong>read</strong> scope of asset-01 resource, not <strong>write</strong>. Also, I have modified the “/home” route slightly to take the name, email and username from the id token or the access token, with the help of a simple <em>parseToken</em> function which converts the base64 encoded jwt’s payload to a JSON parsed object(you can console.log the payload to introspect the token’s content). Lets modify home.ejs a bit to capture the new information we are sending —</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0f89e77d0c1f3608c7d345252594bb08/href">https://medium.com/media/0f89e77d0c1f3608c7d345252594bb08/href</a></iframe><p>Lets see it in action, first logout(“http://127.0.0.1:3000/logout”), followed by a automated redirect to Keycloak’s login page, where you should log in. You should be redirected to “/home” on successful login, where you can see —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ck-kYk3VoYqg_8ubPxV51Q.png" /><figcaption>home</figcaption></figure><p>Then we can go to the url “http://127.0.0.1:3000/asset01” and we should find a success response —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*20dLmBYPQYhfNM9RH2KXMg.png" /><figcaption>asset01 read success</figcaption></figure><p>And the path “http://127.0.0.1:3000/asset01/update” should give an access denied —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P3b67HgxXurX0zAYziKKDg.png" /><figcaption>asset01 write access denied</figcaption></figure><p>So there we go, all done. We have successfully integrated a full fledged IAM software with our application. There are a lot of more things that Keycloak can do, so tweak it, study it, explore it in depth to secure you application the best way possible.</p><p>Thank you for staying this long, hope this series helped you.</p><p>Read Part 1 of this series —</p><p><a href="https://medium.com/theoptimaltechnologist/what-is-keycloak-how-to-use-it-an-example-with-nodejs-part-1-25434e963fed">What is Keycloak? How to use it — an example with nodejs? (Part 1)</a></p><p>Read more on the how to use Keycloak in a production environment with multiple microservices here —</p><p><a href="https://medium.com/@nirabhratapaswi/keycloak-for-securing-enterprise-applications-an-overview-fa99e5d0ab93">Keycloak for securing enterprise applications — an overview</a></p><p>Full Code of tutorial —</p><p><a href="https://github.com/nirabhratapaswi/keycloak-nodejs-tutorial">nirabhratapaswi/keycloak-nodejs-tutorial</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46b562e2b46c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/theoptimaltechnologist/what-is-keycloak-how-to-use-it-an-example-with-nodejs-part-2-46b562e2b46c">What is Keycloak? How to use it — an example with nodejs? (Part 2)</a> was originally published in <a href="https://medium.com/theoptimaltechnologist">theoptimaltechnologist</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Keycloak for securing enterprise applications — an overview]]></title>
            <link>https://medium.com/@nirabhratapaswi/keycloak-for-securing-enterprise-applications-an-overview-fa99e5d0ab93?source=rss-d6fafd26e9d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa99e5d0ab93</guid>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[openid-connect]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[sso]]></category>
            <category><![CDATA[keycloak]]></category>
            <dc:creator><![CDATA[Nirabhra Tapaswi]]></dc:creator>
            <pubDate>Sat, 12 Sep 2020 22:27:47 GMT</pubDate>
            <atom:updated>2020-09-13T19:44:04.433Z</atom:updated>
            <content:encoded><![CDATA[<h3>Keycloak for securing production systems with multiple micro-services</h3><p>In this article, I won’t be diving deep into installing, configuring and integrating keycloak with a specific programming language, rather will be focusing on the whole idea of having an <strong>Identity and Access Management Platform</strong> as a formidable security feature by your side.</p><p>Firstly, let me start by mentioning that you should not need Keycloak for small, single service based application with minimal scaling. You can go with other language specific token management libraries(e.g. implementing jwt), backed by simple user databases. Keycloak, or any other full fledged solutions(like Auth0), must be used when your solution comprises multiple services/applications working independently, like in a microservice environment.</p><p><em>(Skip if you already understand SSO)</em>One of the important components to consider before writing an authentication and authorization layer is to answer the question — do you need a Single Sign On solution? To understand Single Sign On(SSO), let us take the example of google.com. When you sign in to your gmail account(assuming you have an account), firstly you will notice that the url changes from gmail.com to accounts.google.com, where you are asked to enter your credentials. After you log in successfully, you are redirected to gmail.com as intended, where you maybe send some mails etc.. Suddenly, a colleague asks you to send him/her a document which is fairly large in size(say 1Gib). You being a smart individual, decide not to attach it in an email, rather upload it to some cloud storage, and share with the other individual that document. You decide you will do this via google drive. Now, when you enter drive.google.com in your browser’s url tab, you would expect drive.google.com to verify your identity by asking you your credentials, but to your surprise you find yourself logged in without having to authenticate yourself. For a moment you would wonder if google, or maybe your browser is keeping track of your passwords and auto entering them on similar websites; but as you come to your senses realizing that google won’t do anything that stupid duh! And you seem to enjoy this magical little feature as a convenience.</p><p>What really happened was that when you first signed in to accounts.google.com, certain tokens were set in your browser cookies. These cookies are readable by all urls with common domain google.com. So when you visit any other site which is a subdomain of google.com, you will see that you don’t need to verify your identity again. This is achieved with the help of <strong>SSO!</strong> Single Sign On is a paradigm of the authentication world, where your identity is verified by a central entity only once, and others follow.</p><p>Now that we have all heard a good story with familiar experiences, lets take a graphical view of actual systems before getting into more details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*XrYsHmXlN1lK4D-STUi4XQ.png" /><figcaption>SSO Overview</figcaption></figure><p>We can see in the above diagram, that the user from its browser is trying to access 3 different applications, which belong to the same software backend. The user initially signs in to the software by getting redirected to a different authentication application(may be in a different domain also), which is returns back a authorization code to the client sitting on application 1/2/3(where the user actually wants access). These sitting at application 1/2/3 exchange this code for access tokens from the auth server, on behalf of the user and also in turn verifying their identity(else auth server would not have sent a code in the first place). Any subsequent calls made to the applications involves this access token passed by browser(via cookies, headers etc., whichever medium is suitable), and verified by the client sitting on the backend applications(connected to the auth server), hence validating the identity of the requesting party(browser in this case).</p><p>Lets dive deeper, taking an example of a story sharing website backed by a microservice backend architecture. Lets say our website has 3 individual service components(apart from the frontend) namely:</p><ol><li>Search Engine</li><li>Create/Read/Delete Stories</li><li>Image Server</li></ol><p>Now, look at the following diagram to understand what it would be like to host this website with the backend behind an ingress(a path based load balancer)</p><ul><li>NOTE: Read about load balancers, in depth understanding is not required to understand the following</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*LzAVO8dplOAJfyqksFNZ5A.png" /><figcaption>Keycloak with Microservice Architecture</figcaption></figure><p>In the above diagram, we can see that the browser is logging in to the /auth endpoint(which hosts keycloak), gets the access token, and passes it to every subsequent request to the other /story,/search,/image endpoints. These endpoints in return verify the token via keycloak client adapters, and in case the token is valid, allow them to actually proceed with processing the request. This is one example of how SSO helps ease our lives.</p><p>Before we proceed, I would like to clarify some points and explain a few of them. The flow described here is browser flow, where the client sitting on the server redirects the user to the identity provider, gets back an authorization code, exchanges for an access token and returns to the browser, which is used in all subsequent calls. This is more specifically called <strong>OAuth</strong> protocol, and the flow described above is the <strong>Authorization Code</strong> flow. These are other flows also, out of which I will be discussing one called the <em>implicit flow</em>. I should also point out here that authorization can also be included in the verification process, to check for user permissions alongside identification. I will discuss more on authorization later.</p><ul><li>NOTE: Please read more on OAuth to understand the token flows in detail.</li></ul><p>We are now at an interesting junction of our article, where we have set up a trustworthy authentication/authorization from user side. But what about our server side? Even our servers may be dependent on each other for processing! In our example, lets introduce another microservice which will be dependent on one of the other microservices. Lets build a plagiarism detection feature into our application. Now, for plagiarism checker to work, we may need the combined abilities of story(for read) and search microservices, leaving only the text processing part to the plagiarism detection microservice. Refer the following diagram:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*attHQZ0mfyyDjf0jROvHyA.png" /><figcaption>Server to Server Auth</figcaption></figure><p>You can see in the above diagram that Plagiarism Detection server passes tokens to both Story and Search servers, without which both of the servers would return an unauthenticated error code. But where will this token come from? Think about it, this is a server running in the backend without any user interaction. So based on the above browser flow, there is no user to actually sign in to the Keycloak server and initiating the first token exchange!</p><p>This calls for another type of OAuth flow(as I mentioned earlier): the <strong>Implicit Flow</strong>. You can see the arrows above the Plagiarism Detection server exchanging a token via the client. This is allowed by Keycloak’s confidential client, which allows direct exchange of client credentials for service account dedicated to this client. So, now we have a client adapter sitting at a server, fetching access tokens from Keycloak based on its client credentials(which is actually linked to the service account of the client). The permissions on these access tokens are the same as that of the service account of the client. And these tokens are evaluated by the other servers(in this case Story and Search servers) just like any other access token with certain permissions.</p><p>A point to note here is that as we have set up this entire thing, we have essentially established a <strong>No-Trust-Policy</strong>, which is very crucial for a production system, and prevents calls from unintended services, even if they are part of the same system. Read about <em>token audiences</em> to restrict tokens not intended for that client.</p><p>Keycloak has client adapters for various languages [<a href="https://www.keycloak.org/docs/latest/securing_apps/#openid-connect-3">https://www.keycloak.org/docs/latest/securing_apps/#openid-connect-3</a>]. For languages that do not support official adapters or for extra functionality over present adapters, explore OpenId Connect apis and then check Keycloak apis, which follows the norms. Build the additional functionality based on apis which are quite simple to use once you know what you are doing. Keeping track of active tokens and sessions(refresh tokens) are really important. The adapters manage the cache to an extent, but I would really recommend a custom solution to implement token cache at client side(note client here is w.r.t. keycloak server, i.e. client can be story/search server, or the ui also).</p><p>A caution to exercise is token management in case of implicit flows. Because servers can keep fetching new tokens for every call made to another keycloak protected server, it is important to keep track of active tokens, refresh tokens and not fetch tokens unnecessarily.</p><p>Hope this article gives you a fair idea of how to use Keycloak with microservices. I will write some followup articles on setting up Keycloak, its configurations and in depth exploration of it’s capabilities:)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa99e5d0ab93" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[To the Derivative Beginning]]></title>
            <link>https://medium.com/@nirabhratapaswi/to-the-derivative-beginning-9d7ebf260c02?source=rss-d6fafd26e9d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d7ebf260c02</guid>
            <category><![CDATA[life]]></category>
            <category><![CDATA[science]]></category>
            <dc:creator><![CDATA[Nirabhra Tapaswi]]></dc:creator>
            <pubDate>Thu, 10 Jan 2019 18:31:56 GMT</pubDate>
            <atom:updated>2019-01-11T17:17:59.343Z</atom:updated>
            <content:encoded><![CDATA[<p>As my first blog post, I am sticking to first person narrative. I have thought of many things to write about prior to this, but never found the correct inspiration to do so. Before I start, I would like to mention the greatest inspiration for me to write on this topic was <em>Dan Brown’s </em><strong>Origin</strong>, and it’s fictional character <strong>Edmond Kirsch</strong>.</p><p>Before I introduce my views on the subject, I would like to detail out the <strong>Urey-Miller Experiment</strong>(1954), which aims at revealing the origin of life on Earth. The experiment consisted of a 5L flask, containing a mixture of water, methane, ammonia and hydrogen gases(simulating the initial Earth’s atmosphere), and a 500mL flask of water(simulating the oceans). The water vessel was heated continuously and sent to the gaseous vessel, where electrical sparks was introduced by electrodes, simulating lightning(the most important stimulus to life), and the atmosphere condensed and water allowed to trickle into a U-shaped tube at the bottom. After a day, and later weeks of operations, the solution was collected. This solution, the ‘<strong>primordial soup of life</strong>’(coined by Alexander Oparin in 1924), contained five amino acids. The presence of these amino acids are the building blocks of proteins and hence life itself. The experiment by itself was a success, but sadly scientists later on went on to discover that the early Earth atmosphere consisted of a different composition than the one used. When the experiment was repeated in 1983 with the correct mixture, it failed to replicate the results and was a failure. But another scientist Bada(one of Miller’s own students), figured out the problem with the new composition, that it was turning the water acidic due to the formation of nitrites and destroying the amino acids. But he realized the presence of carbonates and iron in early Earth would have neutralized the nitrates, leading to re-conducting the experiment and producing several amino acids in the mixture and hence gave humanity a view of a possible natural beginning of life.</p><p>I know its a bit boring to go through the above fact and processes, and one can find the details anywhere online, so why bother explaining it? It’s because I want to emphasize on the factual evidence that Science provides, eliminating any conjectures(like life may have been brought to Earth by some meteor) or other non-provable assumptions(like God created life). Moving on, I would like to highlight the importance of this experiment.</p><p>This experiment can solely prove that life was created naturally, without the help of any external artificial input. But won’t that make this article’s title ‘<em>To the Natural Beginning</em>’ Well, it’s not that I gave the title on a whim and was too lazy not to change it, for one, I am typing so much - why not change the title? Haha.. Well, it’s because I won’t be just talking about an idea that is already there, but sharing something that’s beyond this idea. Before moving any further, let me explain what a particular term, “<strong>Entropy</strong>” means, as it be used for further discussion. Entropy in simple terms, the measure of molecular disorder, or randomness in a system. That means entropy hints us how energy is distributed in a system, or how the system is arranged(i.e., it’s tightly packed or scattered). If you want to understand it more, refer wiki or go through this <a href="https://eic.rsc.org/feature/what-is-entropy/2020274.article">link</a>. Extending the Second Law of Thermodynamics, we can say that in this universe, everything occurring either maintains the entropy or increases it, meaning, every process or event happening around us is increasing the disorder in the system(directly or indirectly).</p><p>Let us introduce another idea, proposed by Massachusetts Institute of Technology(MIT), that life is formed following the ‘<em>Law of Increasing Entropy</em>’, and mere luck has nothing to do with it. <strong>Jeremy England</strong>, a physicist at MIT, says that inanimate clusters of organics, is surrounded by heat sources, they may inexorably acquire properties that represent life. These clusters give birth to life in an effort to increase the entropy of the universe furthermore. Jeremy has derived complex Mathematical formulae to, using established Physics, to explain this.</p><p>Based on the above interpretation of life being “<strong>entropy pockets</strong>”(lets term it as <strong>E-pockets</strong>), I shall continue on. Logically, there is an inherent problem, we ourselves are a very definitive state of matter, i.e. that life is not random, but a very order state of matter. Then why would universe want to create us? Let us try to understand that this universe works in a way that increases entropy, and we as E-pockets like living things help the universe achieve that more efficiently. There we go, universe sacrificed a small bit of randomness creating life, and in turn got a Entropy-Increasing machine. This is true, because life takes in an active input(food in some form), processes it and excretes an relatively inactive output, having way less energy than the input. Let me divert the topic slightly explaining us humans specifically. Our world has changed, recent times are very different than the time man carved stone tools to hunt food. But we must understand, with this world of technology, social media, politics, stardom, travel and materialistic affections, our basic need still remains the quality of food we eat, and longevity of life based on healthy food. But, I feel it’s amazing that we have created skyscrapers, aeroplanes, engine powered vehicles, electronics, cosmetics, medicines and so much more, just in order to live more and dissipate energy longer.</p><p>Coming back, I shall continue my discussion on these <em>E-pockets</em>. These E-pockets, life and other things like stars with fusion core, tend to increase the entropy of the Universe. So lets link everything that I have mentioned. In a simple statement, “<em>Life is a natural phenomenon created by the Universe so that it can increase its entropy efficiently.</em>” This also supports the Urey-Miller experiment, proving its success, confirming life has come about naturally given the conditions existing on early Earth. This idea supports also <em>Darwin’s</em> theory of evolution and natural selection to some extent, agreeing with the development of complex structures over time, but stands on top when it comes to the beginning!</p><p>Well then, after so much Science, do I have anything to add of my own? Don’t think, it was rhetorical. Building on these ideas, I would want to share some views about the world we live in, which I have thought for a long time. After I had read about chemical reactions at school, and bio-molecular structures, I felt that if life was made of cells, cells made of molecules, molecules of atoms and atoms, well I don’t want to get into quantum mechanics haha… Well, following the train of thought, I felt that if everything was made up of atoms, and atoms have a tendency to react with other atoms, then isn’t everything we think or feel, just a property of our compositional atoms? I will get back on the thinking part, let’s focus on the feeling for now. Our middle and high school Chemistry taught us that atoms and molecules react with each other generating a more stable compound and generates some form of energy(energy may be light, heat, sound, kinetic, internal or any other). If you think in terms of Entropy it goes like this - two systems of entropy combine to generate a system of lesser entropy and dissipating the balance or more to the surroundings, hence increasing the overall entropy of the universe, or in this case the reaction. Let me move on to explain the most crucial part of life’s origin.</p><p>Imagine the early Earth, with non-living atoms and molecules floating around, reacting with each other. Over time due to favourable conditions, coincidence or God’s will, whatever you may call it, a complex enough reaction took place creating a chunk of molecules attached together. Now, the few possible combinations of simple reaction between molecules turned into an vast range of possible reaction combinations, because now the reactions will take place with not just one molecule, but with a whole chunk of them. This chunk of molecules has become complex, whose physics has to take care not only of the incoming reacting molecule, but also how the reaction will affect the attached molecules. And it’s not as if they want to break up, who does, else they wouldn’t have been formed in the first place. In order for them to not break up, they intercommunicate and device a reaction strategy to apply on the incoming molecule. For simplicity, let us call the chunk of molecules <strong>M</strong> and the incoming molecule <strong>F</strong>. So <strong>M</strong> wants to react with <strong>F</strong> without breaking itself up. <strong>M</strong> then devices a strategy to smartly react with <strong>F</strong> and share the reaction outcome among its constituents, let’s call the constituents <strong>S</strong>. So all the <strong>S</strong>s, which have come together to form <strong>M</strong>, now seem to have reacted with <strong>F</strong> and are happy and proud to have not split up. But what have they got to show for the reaction, maybe another sister <strong>S</strong>? Anyways they, being good siblings have shared whatever they got out of reacting with <strong>F</strong>. This process continued and <strong>M</strong> eventually went on to become bigger and bigger, taking in a variety of <strong>F</strong>s. As many of you have guessed, let me introduce the the characters of my tale: <strong>M</strong> - Microorganism, <strong>F</strong> - Food, and as for <strong>S</strong>, it’s a special one. <strong>S</strong> is ‘Stardust’, because we all were once part of a star, fusing hydrogen and helium to become bigger atoms, have travelled through space and time to get here - a nice thought I deeply value and respect. Its true, everything is a remnant of the early Universe, the exploding stars, supernovas and galaxies. <em>We have billions of years of atomic construction within us, don’t let other people make you feel insignificant, the Universe has conspired to create you.</em></p><p>Anyways, as I was saying, we saw the creation of a microorganism <strong>M</strong> consuming food <strong>F</strong>, and eventually other smaller microorganisms <strong>M</strong>s. If you have followed me, then congratulations, you have constructed life from simple atomic reactions in your head. You see, there is no need for an external force to initiate life, the Laws of Physics are enough to make it happen. Now it’s a small step extending the imagination and seeing the microorganism turn into aquatic life, fishes, reptiles, terrestrial creatures, mammals and finally into apes and humans. The history of life has unfolded in front of your eyes.</p><p>As I am closing in on concluding this article, I would like to explain the title. We have seen that life can be explained with the help of basic Physics laws, and hence can be derived from it. So instead of a <em>Natural Origin</em>, Life is of <em>Derivative Origin</em>, derived from <em>Laws of Physics</em>!</p><p>So, I think I have convinced you readers that we are a mere collection of atoms and molecules floating around in space, increasing entropy. I used to say ‘<em>trying to achieve stability</em>’ instead of ‘<em>increasing entropy</em>’ earlier. So, all the feelings, physical or mental is a reaction of the molecules in your body with those around, nothing more, nothing less. I won’t say there’s no GOD, for I am an agnostic, but do believe that there may exist some creator who programmed the Laws of Physics, hence the Universe.</p><p>Let’s draw a line here. I would get back on thoughts and the implications and impact on our present and future in the next article.</p><p>“<em>In my classroom, T </em>&gt;<em> 0<br>For all inquiries where T = 0<br>Please visit the Religion Department</em>”<br><strong>Dan Brown, Origin</strong></p><h4>Thank You for reading,<br>NIRABHRA TAPASWI</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d7ebf260c02" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>