<?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[Developer’s World - Medium]]></title>
        <description><![CDATA[A place where developer can look in and contribute - Medium]]></description>
        <link>https://medium.com/spring-framework?source=rss----d8754c269a58---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Developer’s World - Medium</title>
            <link>https://medium.com/spring-framework?source=rss----d8754c269a58---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 11:36:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/spring-framework" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Yes that’s true for some cases.]]></title>
            <link>https://medium.com/spring-framework/yes-thats-true-for-some-cases-3c528c4a8f57?source=rss----d8754c269a58---4</link>
            <guid isPermaLink="false">https://medium.com/p/3c528c4a8f57</guid>
            <dc:creator><![CDATA[Abhijeet Chopra]]></dc:creator>
            <pubDate>Sun, 28 Mar 2021 19:30:22 GMT</pubDate>
            <atom:updated>2021-03-28T19:30:22.845Z</atom:updated>
            <content:encoded><![CDATA[<p>Yes that’s true for some cases. But that won’t be always necessary. Actually it would more depend on how your backend drives the routing and which frontend framework or library you are using on your client end.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c528c4a8f57" width="1" height="1" alt=""><hr><p><a href="https://medium.com/spring-framework/yes-thats-true-for-some-cases-3c528c4a8f57">Yes that’s true for some cases.</a> was originally published in <a href="https://medium.com/spring-framework">Developer’s World</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HATEOAS Design Principle. Giving Power To Your Application Backend!!!]]></title>
            <link>https://medium.com/spring-framework/hateoas-design-principle-giving-power-to-your-application-backend-cb1eb5ef2976?source=rss----d8754c269a58---4</link>
            <guid isPermaLink="false">https://medium.com/p/cb1eb5ef2976</guid>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[web-services]]></category>
            <category><![CDATA[design-principles]]></category>
            <category><![CDATA[hateoas]]></category>
            <category><![CDATA[client-server]]></category>
            <dc:creator><![CDATA[Abhijeet Chopra]]></dc:creator>
            <pubDate>Sun, 10 May 2020 18:55:05 GMT</pubDate>
            <atom:updated>2020-05-10T18:55:05.018Z</atom:updated>
            <content:encoded><![CDATA[<p>You would be wondering what I mean by <strong>giving power to your application backend.</strong> So just to give you a brief, <strong>HATEOAS</strong> gives the server/backend the <strong>power to control the flow of your application completely</strong> by letting the client have little to no knowledge of what to do next until the server guides it.</p><p>Anyone who has worked with REST APIs as well as the client-server model and had made their hands dirty by actually implementing such applications, they would have already got an idea of what power I am talking about.</p><p>If not, don’t worry before the article ends you would come to know what kind of power I am talking about.</p><blockquote><strong>Note: In this entire article wherever I have used client it means a frontend side and wherever I have used server it means backend side of the application</strong></blockquote><h3>Introduction</h3><p>Before moving further with HATEOAS its good to have a brief about REST.</p><blockquote>What is REST (Representational State Transfer)?</blockquote><blockquote>It’s an architectural style that lays down some standards which need to be followed while creation of Web Services. The Web Services that follow REST provides interoperability between different systems over the internet.</blockquote><blockquote>The best example of RESTful APIs are web services working with JSON objects. As JSON objects are cross-platform due to which the same web service can be used on a mobile platform as well as web browsers.</blockquote><p>Now starting with HATEOAS design principle:</p><p><strong>HATEOAS</strong> stands for <strong><em>Hypermedia As The Engine Of Application State. </em></strong>It is<strong> </strong>a part of <strong>REST application architecture </strong>and <strong>is a constraint for REST.</strong></p><p>Here <strong>Hypermedia</strong> refers to any content that contains links to other forms of media such as video, audio, image, and text.</p><p>This design principle states that when the client interacts with the server, the <strong>server provides information dynamically in the form of hypermedia. </strong>Due to this client should have very little to no knowledge about how to interact with the server. Here we used a phrase <strong>little knowledge</strong> because the client should know regarding <strong>how to deal with hypermedia.</strong></p><p>Actually in this, if we think from the <strong>application state and flow perspective </strong>everything depends on the server, like what action should be available to the client after a particular action/API is performed by the client.</p><p>The client does not know what are the actions that would be available after a particular action is performed and so the client itself will work with little to no business/application knowledge on their side.</p><p>Now you must have understood the meaning HATEOAS design principle which in short states that using <strong>hypermedia we can control the state of the application and so hypermedia is referred to as an Engine Of Application State.</strong></p><h3>After such a long explanation now let’s jump on to an example to get a better understanding of whatever we read above</h3><p>For example, there is a REST API that gives information about the bank account detail of a user and the response of the API is in JSON format as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0HfgnDXc_GgbmKQEbtNzyA.png" /><figcaption>Get Account Details API JSON Response</figcaption></figure><p>So here as you can see with other pieces of information regarding the account details like account_number, balance, <strong>there is a set of links provided.</strong></p><p>These are the links that are the available actions for the client to perform after the action of fetching the account detail is performed.</p><p>Here if you noticed based on the REST API response client can decide which next actions can be performed. Due to this client doesn’t need to know about any other actions of the system beforehand.</p><p>After having available actions, for example, the user <em>(that is using the client to access the server) </em>decides to proceed with <strong>withdraw action</strong> and the user withdraws <strong>USD 125.</strong></p><p>The response from the <strong>withdraw API</strong> is shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G6mR2xD0OwVB7_R1dzTq5w.png" /><figcaption>Withdraw API JSON Response</figcaption></figure><p>So here now the total amount (value) in the bank account is <strong>negative</strong> and due to which only one action is available for the user, which is depositing the money in the bank account.</p><p>All other actions that were previously available are no longer available due to the business requirement, that is if the total amount in the bank account of the user is negative he/she cannot:<strong> withdraw, transfer or close the account.</strong></p><p>Here you can see that clients don’t need to maintain any flow or logic such as if the amount is negative then don’t show the other options except deposit.</p><p>All this is taken care of by the server at runtime and the client is provided with this information/state of the application on runtime by the hypermedia (hyperlink + other data) provided in the response of the previously performed action by the client. That’s <strong>why we call it as Engine Of Application State.</strong></p><h3>Final Words</h3><blockquote>This way we can completely make the client-side dynamic, which act according to the responses of the REST APIs(actions) previously performed by the client and so the client do not require more knowledge of how to interact with the server beforehand.</blockquote><p>Here just to make one thing clear, <strong>the client would be having an initial/base URL API endpoint for the server</strong>, and then from there it would be dynamically changing the state of the application depending on the links available in the response of the action performed.</p><p><strong>So hyperlink changes the application state and it is not the other way around.</strong></p><p>Using <strong>HATEOAS</strong>, REST client (or simply client) don’t have to hardcode the URL structures of the application resources beforehand.</p><p>This also decouples the client and the server in the sense if the server needs to change/evolve the URL of any of its resources it can easily do without having any changes needed to be done on the client end. Because now it would not be hardcoded and this is how HATEOAS decouples client and server which in turn enables server functionality to evolve independently.</p><p>Thanks for reading the article!!!</p><h3>References</h3><ol><li><a href="https://en.wikipedia.org/wiki/HATEOAS">https://en.wikipedia.org/wiki/HATEOAS</a></li><li><a href="https://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven">https://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb1eb5ef2976" width="1" height="1" alt=""><hr><p><a href="https://medium.com/spring-framework/hateoas-design-principle-giving-power-to-your-application-backend-cb1eb5ef2976">HATEOAS Design Principle. Giving Power To Your Application Backend!!!</a> was originally published in <a href="https://medium.com/spring-framework">Developer’s World</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring Security Authentication Process Explained In Detailed]]></title>
            <link>https://medium.com/spring-framework/spring-security-authentication-process-explained-in-detailed-5bc0a424a746?source=rss----d8754c269a58---4</link>
            <guid isPermaLink="false">https://medium.com/p/5bc0a424a746</guid>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[spring-security]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Abhijeet Chopra]]></dc:creator>
            <pubDate>Sun, 10 Nov 2019 12:57:53 GMT</pubDate>
            <atom:updated>2019-11-10T14:07:43.337Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a continuation of my <a href="https://medium.com/spring-framework/introduction-to-spring-security-de6e2dabaea"><strong>previous article</strong></a> in which I have given an introduction to spring security along with an explanation of what does actually <strong>Authentication and Authorization</strong> means.</p><p>In this article, We are going to cover the details about how does the authentication process in spring security works and along with that, we would also get familiar with core interfaces and classes used by the spring for the authentication process. <strong>We will try to keep it general and not specific to web applications only.</strong></p><p><strong>For Web Application specific authentication and authorization process I will come up with another article.</strong></p><p>Ok so let&#39;s start!</p><p><strong>Note: Anything that is in bold and enclosed in inverted commas represents a class or interface name in spring security. Ex: “ClassName”</strong></p><h3>Core classes and interfaces</h3><p>Before getting into the details of how actually authentication process works in spring security we would first like to understand some of the core important classes and interface that we need to use in the authentication process.</p><h4>“AuthenticationManager”</h4><p>It is a core interface that spring security uses for the authentication process. It has only one method <strong>authenticate </strong>which when implemented in a class that implements an Authentication Manager has <strong>all the logic for authenticating a user request.</strong></p><p>The authenticate method takes an “<strong>Authentication”</strong> object as its parameter and returns an “<strong>Authentication”</strong> object on successful authentication of the user or else we can have an exception thrown indicating that the user is not authenticated.</p><p>Spring security has a default implementation for Authentication Manager that is “<strong>ProviderManager” </strong>which itself delegates the authentication request to list of configured “<strong>AuthenticationProvider”</strong>s which can either return a fully populated “<strong>Authentication”</strong> object, <strong>throw an exception </strong>when authentication is failed<strong> or return null</strong> if it needs to skip the authentication for a particular authentication request.</p><p>We will not go in detail of “<strong>ProviderManager”</strong> or “<strong>AuthenticationProvider”</strong> as proceeding further in this article we will create our own class that implements “<strong>AuthenticationManager” </strong>that would actually substitute “<strong>AuthenticationProvider”</strong>s as well as “<strong>ProviderManager</strong>” itself.</p><p>Below is a code snippet from my demo application in which I have implemented “<strong>AuthenticationManager”:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/71fc2e3c29254841a6a6bf255d6d09b2/href">https://medium.com/media/71fc2e3c29254841a6a6bf255d6d09b2/href</a></iframe><h4>“Authentication”</h4><p>It is a core interface that represents security information(Principal, Credentials, Authority list, etc.) in a spring security specific manner.</p><p>It is used by the entire framework whenever there is a need to get authentication details of a particular request.</p><p>Frequently used implementation of the “<strong>Authentication”</strong> interface is “<strong>UsernamePasswordAuthenticationToken”</strong>. It is not a direct subclass of “<strong>Authentication”</strong> but it is a child of an abstract class that implements an “<strong>Authentication”</strong> interface.</p><h4><strong>“UserDetailsService”</strong></h4><p>It is a core interface that is used by spring security to return the “<strong>UserDetails”</strong> object. It is purely used to return user data wrapped in the form of “<strong>UserDetails”.</strong></p><p>It has one method <strong>loadUserByUsername(String userName). </strong>As you can see it takes one String-based argument username and it returns a “<strong>UserDetails”</strong> object.</p><p>The only purpose of “<strong>UserDetailsService”</strong> is to provide a “<strong>UserDetails</strong>” object to other components of the spring security framework.</p><p>Below is a code snippet from my demo application in which I have implemented “<strong>UserDetailsService”:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a38838223e992099d2e59fed4ac64809/href">https://medium.com/media/a38838223e992099d2e59fed4ac64809/href</a></iframe><h4><strong>“UserDetails”</strong></h4><p>It acts as an <strong>adapter</strong> between your application’s user representation and the representation of the user’s details that are needed by the spring security framework in the “<strong>SecurityContextHolder”</strong> which is basically used to build the “<strong>Authentication”</strong> object and have other functionality too which is described in next section.</p><p><strong>“UserDetails”</strong> basically holds principals, credentials, authorities and other information that is regarding a particular user.</p><h4><strong>“GrantedAuthority”</strong></h4><p>It is an interface that represents authorities that are granted to the user. A class implementing this interface should provide the representation of the user authority that is supported by “<strong>AccessDecisionManager” </strong>that we will cover in the next article that is on Authorization in spring security.</p><p>It is provided in the “<strong>UserDetails”</strong> object and used to give application-wide permissions. It should not be used to give per object permission for that spring security provided other interface.</p><p>It is usually loaded in “<strong>UserDetailsService”</strong> implementation.</p><h4><strong>“SecurityContextHolder”</strong></h4><p>It is a core class of the framework that is used to store “<strong>SecurityContext”</strong> information of the principal currently using the application.</p><blockquote><strong>“SecurityContext”: Information that represents the Authentication and Authorization information of the user currently access the application.</strong></blockquote><p>SecurityContextHolder uses “<strong>ThreadLocal”</strong> variables to store the principal details.</p><p>ThreadLocal class provides variables that are local to a thread. Each thread has a copy of these variables and these variables are not shared between the threads in a multi-threaded environment.</p><p>So basically “<strong>SecurityContextHolder”</strong> uses “<strong>ThreadLocal”</strong> variables to store user information and so handles multiple requests that work in a multi-threaded environment in which each thread consists of the “<strong>SecurityContext”</strong> information.</p><p>It&#39;s important to clear/remove security information once the request is processed and that is taken care of by the “<strong>SecurityContextHolder” </strong>in the framework.</p><p>We can configure “<strong>SecurityContextHolder” </strong>in a way our application wants the security information to be handled throughout the application requests that are made by the user.</p><p>There are three ways as follows:</p><ol><li>MODE_THREADLOCAL (Default): It is used as default by the spring security in which each request thread carries the “<strong>SecurityContext”</strong> information. <strong>Generally used in Web applications.</strong></li><li>MODE_GLOBAL: All the request threads will use the same “<strong>SecurityContext”</strong> Information. It can be used in <strong>Desktop applications</strong> such as applications made in Swing. So the Authentication object is the same all over the application.</li><li>MODE_INHERITABLETHREADLOCAL: All the child threads born from the secure parent thread will have the same “<strong>SecurityContext”</strong> information as to their parent thread.</li></ol><p>So we can see that “<strong>SecurityContextHolder”</strong> stores security information in the “<strong>SecurityContext”</strong> interface implementation which is actually stored in thread-local.</p><p>And in “<strong>SecurityContext” </strong>security information is represented in the form of an “<strong>Authentication”</strong> object which in turn stores the information in the form of the “<strong>UserDetails”</strong> object that actually represents user information in the framework.</p><p>Below is a code snippet from my demo application in which I have used “<strong>SecurityContextHolder”:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2396c803a7641ac1ca93b87e82c87293/href">https://medium.com/media/2396c803a7641ac1ca93b87e82c87293/href</a></iframe><h4><strong>Below is a flow diagram that will describe the authentication process in a more understandable manner and will connect all the dots from the above-described classes and interfaces:</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/276/1*ot2Ltz4BI2BALlhlFsvbWQ.png" /></figure><p><a href="https://github.com/abhijeetchopra05/spring-banking.git"><strong>Here</strong></a> is the link to an application in which I have implemented spring security in a spring boot project with the concept of JWT along with spring security. The application is basically in progress but the spring security part is done and you can find it in the config folder. It is a web application so some of the concepts are not covered in this authentication article as I wanted to focus more on details of the authentication process and wanted to keep is article generic and not specific to web application security.</p><p><a href="https://github.com/abhijeetchopra05/spring-banking.git">abhijeetchopra05/spring-banking</a></p><p>References are taken from the following official document of spring security:</p><p><a href="https://docs.spring.io/spring-security/site/docs/current/reference/html/overall-architecture.html">9. Architecture and Implementation</a></p><p><strong>In this series of spring security articles, the next topic is as follows:</strong></p><ol><li><strong>Details of Authorization in spring security.</strong></li><li><strong>Web Security using a sample application.</strong></li></ol><p>Thanks for reading this article. I hope you are now clear about the authentication process in spring security. Please mention your valuable comments in the comment section.</p><p>To get in touch with me you can mail me on <strong>“abhijit.chopra5@gmail.com”.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5bc0a424a746" width="1" height="1" alt=""><hr><p><a href="https://medium.com/spring-framework/spring-security-authentication-process-explained-in-detailed-5bc0a424a746">Spring Security Authentication Process Explained In Detailed</a> was originally published in <a href="https://medium.com/spring-framework">Developer’s World</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Spring Security]]></title>
            <link>https://medium.com/spring-framework/introduction-to-spring-security-de6e2dabaea?source=rss----d8754c269a58---4</link>
            <guid isPermaLink="false">https://medium.com/p/de6e2dabaea</guid>
            <category><![CDATA[spring-security]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[authorization]]></category>
            <dc:creator><![CDATA[Abhijeet Chopra]]></dc:creator>
            <pubDate>Sun, 10 Nov 2019 12:55:59 GMT</pubDate>
            <atom:updated>2019-11-10T13:38:42.200Z</atom:updated>
            <content:encoded><![CDATA[<h3>Overview</h3><p>Spring Security is a framework that when integrated with the spring framework gives the capability to the application of having a standard way of authentication and authorization (access control) mechanism.</p><p>It consists of many pre-built ways of authentication and authorization that are given by the spring security developer ranging from in-memory authentication to JDBC authentication and many more. It is easily configurable and extendable to meet the needs of a specific application.</p><p>It can be used for any type of application from desktop/standalone to web applications and using it we can setup application security in a few hours.</p><p><strong>Spring Security works in a self-contained manner</strong> which means that every file that is needed by spring security framework is present in your application when you configure spring security in your application and there is no need of any special configuration/policy file that needs to be added to the JVM or there is no need to add spring security to common classpath location.</p><blockquote>In Technical terms, <strong>spring-security for web application</strong> is nothing but a <strong>chain of servlet filters</strong> that are stacked on one another in a specified order depending on the security needs of an application.</blockquote><h3>What is Authentication?</h3><p>Many people still get confused when the word authentication comes in the picture <strong>so before diving, in detail of authentication in spring security that you can read in my </strong><a href="https://medium.com/spring-framework/spring-security-authentication-process-explained-in-detailed-5bc0a424a746"><strong>up-coming article</strong></a> we would first get a clear understanding of <strong>what does authentication actually means.</strong></p><blockquote>So authentication in lay man&#39;s language is <strong>when a person tries to access some resources(data) that is restricted then he/she needs to get identified and verified so that the system can confirm whether the user is actually the right person to do so.</strong></blockquote><p>One of the most common examples of authenticating a person in an application is by using the username and password that a user decides on there own at the time of the creation of their account in an application.</p><p>So at the time when you log in to Facebook or Instagram by providing <strong>username and password</strong>, you are getting authenticated by the application so that it can decide whether you are allowed to enter the application or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*u8u8zNATMIPFK2bV" /><figcaption>Typically authentication process for a simple website login</figcaption></figure><h3>What is Authorization?</h3><p>Once a person is authenticated by the application then the next step comes is authorization.</p><p>So authorization is determining the extent of a user to access the restricted resources. The application ensures that the user is only allowed to access parts of the resource that he/she is allowed to.</p><p>This means that even if a user is authenticated and gets entry into the application he/she can only access a limited version of the resource depending on the level of clearance the user has for the application.</p><p>For example in a 10 story government building suppose a person with an identity card has access of 1st to 8th floors then if he/she tries to access 9th or 10th floor the security guard (system security portion/code) wouldn’t allow that person after seeing the identity card which tells that the user is not allowed on these floors. So even if the person has the right to enter the building that does not mean that he/she has access to all the floors of the building. Same way if a user is authenticated to enter a system that does mean he/she is allowed to access all the resources of the system.</p><p>The authorization mechanism is sometimes also called an <strong>access control mechanism</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/0*fpUAB7f-esIKjzrT.png" /><figcaption>List of roles that gives different permissions/authority to users on the actions that they can perform for any random application.</figcaption></figure><p>Thanks for reading this article. It’s my point of view on <strong>authentication, authorization and spring security</strong>. If you have some other point of view please mention in the comments section.</p><p><strong>My next article is on how does spring security actually performs the authentication mechanism from the architecture and implementation point of view. In which I have covered most of the core interfaces and classes that are used by spring security to implement the authentication mechanism. The link to that article is given below:</strong></p><p><a href="https://medium.com/spring-framework/spring-security-authentication-process-explained-in-detailed-5bc0a424a746">Spring Security Authentication Process Explained in detailed</a></p><p>To get in touch with me you can mail me on <strong>“abhijit.chopra5@gmail.com”.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de6e2dabaea" width="1" height="1" alt=""><hr><p><a href="https://medium.com/spring-framework/introduction-to-spring-security-de6e2dabaea">Introduction to Spring Security</a> was originally published in <a href="https://medium.com/spring-framework">Developer’s World</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>