Search results for: Spring Security

In this tutorial, you will learn how to generate a custom JSON Web Token(JWT) and how to add and validate custom JWT Claims using the io.jsonwebtoken library. The JWT token generated in this tutorial will be signed with a SecretKey, making it secure and tamper-proof. Also, this tutorial assumes you have prior knowledge of creating…

Read More Generate JWT. Add and Validate Custom Claims.

Reactive Programming, a powerful paradigm in modern software development, revolutionizes the way we handle data and events. By embracing reactive principles, developers can build highly responsive and scalable applications. In this tutorial, we will explore the fundamentals of Reactive Programming, its benefits, common use cases, and delve into real-world examples to demonstrate its practical applications.…

Read More Introduction to Reactive Programming

Testing is an essential skill for any Java developer. It helps you ensure the quality and reliability of your code, as well as find and fix bugs faster. On this page, you will find a collection of tutorials that will teach you how to test Java code using JUnit 5 and Mockito. JUnit 5 is…

Read More Testing Java Code

In this REST Assured tutorial, I will demonstrate how to evaluate the JSON content that is returned in the response body of an HTTP response. What is REST Assured? REST Assured is a Java-based library for testing RESTful web services. It provides a domain-specific language (DSL) for writing tests that interact with web services using…

Read More Validate JSON Response with REST Assured

In Spring Boot 3, the authorizeRequests() method of the WebSecurityConfigurerAdapter class has been deprecated. This method was previously used to configure the authorization rules for securing web applications. To secure your application in Spring Boot 3 using Spring Security, you should use the HttpSecurity class and its authorizeHttpRequests() method instead. You can use the authorizeHttpRequests() method…

Read More Migrating from a Deprecated autorizeRequests()

In this tutorial, I’ll guide you on how to use the new OAuth2 Authorization Server(v0.0.3) built by the Spring Team. Below are the new features that have been introduced in the newer version: Enforce one-time use for authorization code Introduce OAuth2 Tokens Add Refresh Token grant Implement Token Revocation Endpoint OAuth2 is an authorization method…

Read More The New OAuth2 Authorization Server

What do you want to learn today? OAuth 2 Recent Tutorials Spring Security OAuth 2 Social Logout Sergey Kargopolov Keycloak | OAuth 2 In this short tutorial, you will learn how to configure the /logout functionality in your Spring Boot Web application that uses OAuth2 Social Login. To Read More Spring Security OAuth 2 Social…

Read More OAuth 2

In this tutorial, you will learn how to use @AuthenticationPrincipal annotation to get the Jwt object containing the details of a provided in HTTP Request access token. When we send a request containing an access token in the Authorization header, behind the scenes,  Spring Framework will do a lot of work and if all is good,…

Read More @AuthenticationPrincipal – Getting the Jwt Claims

This tutorial will teach you how to create a JPA Native SQL Query to only select information from specific columns. You can find many more Spring Data JPA-related tutorials on this site. Some of the most popular tutorials are: One-to-One Mapping Hibernate/JPA Using Spring Boot and MySQL One-to-Many Mapping Hibernate/JPA Using Spring Boot and MySQL…

Read More Select Specific Columns with JPA Native Query

In this blog post, I am going to list commonly used POM.XML dependencies for building RESTful Web services with Spring Boot and Spring MVC. The list of below dependencies is not complete and will depend on the functionality you need your RESTful Web Services to support. But if you are building a simple REST API…

Read More Common POM.XML Dependencies for RESTful Web Services

In this short tutorial, I am going to share with you how to enable CrossOrigin in a RESTful Web Service API built with Spring Boot that also has Spring Security enabled. Enable CrossOrigin for Specific Endpoint  To enable cross-origin AJAX HTTP requests to a specific RESTful Web Service endpoint in our Rest Controller class we can use…

Read More CrossOrigin and CORS in RESTful Web Service