Password Encoder in Spring Security

In this post, We will take a look at password encoders in detail with an example. Traditionally, storing passwords were hard. The application will have to encode user passwords and store them in a database. But with password encoders provided by spring security, all of these can be done automatically. Password Encoders are beans that…

UserDetailsService : Loading UserDetails from database

In the last post, We have seen how easy it is to set up an in-memory UserDetailsService and dynamically add users to the applications. However, we all know that the implementation is only good for demos and short-lived applications. Once these applications are stopped, All the information about the users is lost. This is why…

In-Memory UserDetailsService in Spring Security

In this post, we will take a look at how the default in-memory UserDetailsService works in Spring Boot application. Default behaviour The default autoconfiguration provides an InMemoryUserDetailsManager that generates a single user for the application to support. We can override these user properties to an extent with changes to application.properties file. For instance, you can change the default username…

Basic Authentication in Spring Boot

Let’s learn how to implement Basic authentication in a Spring MVC application with an example. Configure Basic Auth To set up basic authentication, you need to provide our own HttpSecurity configuration. Similar to providing custom login form, this setup also requires a custom WebSecurityConfigurerAdapter as shown below. This is the only change that you have to do. After…

Session Tracking modes in Spring security

Applications maintain their state with the user using a concept called session. In this post we will see about different type of session tracking modes and how they work. When an application authenticates a user, it can do two possible things. Forget about the user after the request is processed and user will have to authenticate for each…

Custom Login Form in Spring Security

In this post, We will take a look at providing a custom form login in a spring boot application. The default spring boot form login may not fit everyone’s need. For example, Some organization may want to put a logo on their login page. Some may find the default login forms less appealing. For some perfectionists,…

Form Login with Spring Boot

This article concentrates on the default form login implementation from Spring Boot and Spring Security. Let’s dive in to understand spring security with form-based username and password login. To start with, I have written a simple web application with an API that prints hello world. There is nothing special about this Controller. When we open…

Spring Security

What is Spring Security? It is a powerful and highly customizable authentication and access-control(RBAC) framework. It is the standard for securing Spring-based web applications. This framework focuses on providing both authentication and authorization to Java applications. Similar to other modules, You can easily extend the Spring Security module to meet custom requirements. Features Here are…

Spring Boot Redis Cache Example

Let’s learn how to implement Redis as a cache store in spring boot with an example. Previously, We discussed how to enable caching implementation in Spring Boot using an in-memory cache manager. But, there were a few drawbacks to that approach. This is where the Redis cache store comes into the picture. Introduction Redis is…

Spring Cache For Better application performance

Let’s learn how to implement cache mechanisms in Spring Boot using @Cacheable annotation with an example. Introduction to Spring Cache abstraction Caching is a concept that improves response time by storing copies of most frequently used data on a temporary but fast storage. In this article, We will see how to enable caching for a…