<?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 Samidi Jayawickrama on Medium]]></title>
        <description><![CDATA[Stories by Samidi Jayawickrama on Medium]]></description>
        <link>https://medium.com/@samidisjg?source=rss-32fc45f919f9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*o5Fm5Vh7fDj0DTy0mIKf5w.jpeg</url>
            <title>Stories by Samidi Jayawickrama on Medium</title>
            <link>https://medium.com/@samidisjg?source=rss-32fc45f919f9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 16:55:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@samidisjg/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[Understanding OpenID Connect (OIDC) and Common Authentication Issues. ]]></title>
            <link>https://medium.com/@samidisjg/understanding-openid-connect-oidc-and-common-authentication-issues-31893d4ccca5?source=rss-32fc45f919f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/31893d4ccca5</guid>
            <dc:creator><![CDATA[Samidi Jayawickrama]]></dc:creator>
            <pubDate>Thu, 06 Feb 2025 10:28:22 GMT</pubDate>
            <atom:updated>2025-02-06T10:29:59.050Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vib_cOJpti9cmiLeJCXkDA.png" /><figcaption>Visual Representation of OIDC Flow</figcaption></figure><h3>What is OpenID Connect (OIDC)?</h3><p>OpenID Connect (OIDC) is an identity layer built on top of OAuth 2.0. It provides a secure way to authenticate users and share their identity information across different systems. OIDC is commonly used in modern web and mobile applications to ensure that users can log in securely and seamlessly.</p><h3><strong><em>Key Components of OIDC</em></strong></h3><h4>1. ID Token:</h4><ul><li>The ID token is specific to OIDC and serves as proof that a user has been authenticated.</li><li>It is typically formatted as a JSON Web Token (JWT).</li><li>This token contains information (called claims) about the user and the authentication process.</li><li>Claims may include data such as the user’s persistent ID, email address, or name.</li><li>ID tokens should always be digitally signed to prevent tampering and may also be encrypted for additional privacy.</li></ul><h4>2. Access Token:</h4><ul><li>Defined by OAuth 2.0, an access token provides temporary permission to access specific user resources.</li><li>These tokens are usually short-lived and only granted when the client needs to access protected resources.</li><li>Standalone applications that don’t require external resource access usually don’t need access tokens.</li></ul><h4>3. Refresh Token:</h4><ul><li>Refresh tokens also come from OAuth 2.0 specifications.</li><li>They are long-lived tokens that can be used to obtain new access tokens without requiring the user to log in again.</li></ul><h3>OIDC in Action</h3><p>When a user logs into an application using OIDC:</p><ol><li>They provide their credentials to the identity provider.</li><li>If authenticated successfully, the identity provider issues an ID token.</li><li>Optionally, access and refresh tokens are issued if resource access is required.</li><li>The client application uses the tokens to maintain the session and request resources securely.</li></ol><blockquote><strong><em>Common Authentication Errors</em></strong></blockquote><p>While OIDC improves security and user experience, issues can still arise. One common problem is token expiration.</p><p>Example Error Log:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*AXqAGdEO-mAPCWzA6QxNGg.png" /></figure><h4>Understanding the Error:</h4><ul><li>Error: ERROR_OPEN_ID_TOKEN_EXPIRED</li><li>Description:<strong> </strong>This error occurs when the ID token used for authentication has expired.</li></ul><p><strong>Why Do Tokens Expire?</strong></p><p>Tokens have expiration times to enhance security. If a token is compromised, the expiration limits the time an attacker can use it.</p><blockquote><strong><em>How to Handle Token Expiration Issues:</em></strong></blockquote><ol><li><strong>Extend Token Lifespan</strong>:</li></ol><ul><li>If needed, you can configure your token server to issue tokens with a longer lifespan or set a longer expiry time based on the needs of your application, balancing security and convenience.</li></ul><p><strong>2. Use Refresh Tokens:</strong></p><ul><li>When an ID token or access token expires, a refresh token can be used to obtain a new one.</li></ul><p><strong>3. Token Expiry Alerts:</strong></p><ul><li>Implement logic to alert users or automatically refresh tokens before they expire.</li></ul><p><strong>4. Secure Storage:</strong></p><ul><li>Ensure tokens, especially refresh tokens, are securely stored.</li></ul><p><strong>5. Error Handling:</strong></p><ul><li>Provide user-friendly error messages when token expiration issues occur.</li></ul><h3><strong><em>Conclusion</em></strong></h3><p>In conclusion, OpenID Connect is a great way to securely authenticate users. It’s important to understand the key components, ID tokens, access tokens, and refresh tokens ,since they help manage issues like token expiration. By following best practices for handling tokens, developers can create secure and user-friendly applications.</p><p>I hope this gives you a clearer understanding of OIDC.</p><p>Thanks for reading! 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31893d4ccca5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MVC Architecture in Java.]]></title>
            <link>https://medium.com/@samidisjg/mvc-architecture-in-java-033631e04b7b?source=rss-32fc45f919f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/033631e04b7b</guid>
            <dc:creator><![CDATA[Samidi Jayawickrama]]></dc:creator>
            <pubDate>Tue, 19 Dec 2023 21:05:31 GMT</pubDate>
            <atom:updated>2023-12-19T21:05:31.246Z</atom:updated>
            <content:encoded><![CDATA[<p>What is MVC Architecture?</p><p>By precisely, MVC architecture follow MVC design pattern. When creating software, model designs are used to keep the application logic and user interface apart. The MVC pattern architecture consists of three layers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*uwK5dRoKn3ycXqyYIbbOtA.jpeg" /><figcaption>MVC Architecture</figcaption></figure><p>Next let’s see what are those 3 layers in this architecture.</p><h4>1.Model</h4><p>This represents the business layer of the application. This can update the controller incase of data is changed. This works like an object which carries data from database to controller. The model object fetches and store the model state in the database.</p><p>All the Database manipulations and modifications are included in this section. This is contained simple java classes.</p><h4>2.View</h4><p>This is the user interface in the application. The section that client interact with. This visualizes the data that model contains. All the Jsp files are stacked under this view section.</p><p>It sends the requested data to the client, that is fetched from model layer by controller.</p><h4>3.Controller</h4><p>This section works between model and the view. This manages the workflow between model and the view. This contains java servlet classes.</p><p>The view layer sends user requests to the controller layer, which performs the required validations and handles them. The model receives the requests and processes the data. The data is processed, returned to the controller, and then shown on the screen.</p><h3><strong>How MVC architecture works?</strong></h3><p>I simply tell you this in four steps. So that you can easily understand the work flow of this architecture.</p><p>1.On the server side, a client (browser) requests a page from the controller.</p><p>2.The model is then called by the controller. It collects the data that is required.</p><p>3.The data that was retrieved is then sent to the view layer by the controller.</p><p>4.The view now sends the result back to the browser (client).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*oxbRmwx8Z1j6gIyda2Npug.jpeg" /></figure><p>Let’s go through a simple customer login scenario to understand this concept.</p><ol><li>This is customer details insert java servlet class.(Controller)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Y8md3yBj88H9q0mTOYJcg.png" /><figcaption>Java servlet class.</figcaption></figure><p>2.This is customer details insertion to database.(model class — simple java class)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S8TtFyB43XNTBrtXS5IYUQ.png" /><figcaption>simple java class</figcaption></figure><p>This is customer details insertion form interface.(view — Jsp file)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*yRq6WSN7YefTLxy9tQ8tSQ.png" /></figure><p>This is the view of the inserted data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ju_4kapJtZ5QVFk8FdXsAw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*8aFnq1eWM6Xz9fYB77euiA.png" /></figure><p><strong>Conclusion</strong></p><p>In this article I have explained the simple idea of the MVC architecture in java along with some simple code snippets. Hope you will get a better idea of the actual workflow of the MVC architecture and the usage of it.</p><p>Thank you for reading!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=033631e04b7b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>