Java

How-to Tutorials for Spring Security OAuth2 & REST API

In this post, I have listed down some of the top pages which I came across while doing exploring implementation for Spring Security OAuth2 for REST APIs based apps. This page will be updated with good links in time.

  • Secure a Spring Boot REST API With JSON Web Token + Reference to Angular Integration
    • This one is very helpful (by-far-the-best) for developers doing Angular App on the client side and Spring Boot app on the server side. Really a great step-by-step tutorial. Kudos to Author, Nouhoun Y. Diarra. Covers some of the following topics. Github project can be found on this page.
      • Configure spring security
      • Configure authorization server
      • Configure resource server
      • Configure data source
      • Provide scripts for database
      • Provides a sample Controller (RestController)
      • Provides instructions for running/testing the app
    • For those working with latest Spring framework and Spring boot, you may notice that SHAPasswordEncoder is no more supported as demonstrated in this article. Thus, you may have to use password encoder such as BcryptPasswordEncoder. You have to make changes such as some of the following:
      • Generate client-secret using BcryptPasswordEncoder and update application.properties file.
      • Update SecurityConfig.java file to use BcryptPasswordEncoder by using code such as new BCryptPasswordEncoder(). If you want to get access to the updated file, I have a private Github project created with MySQL database. Please feel free to reach out and I would share the code.
  • Oauth2 Stateless Authentication with Spring and JWT Token
    • A GitHub project with simple and great code for implementing JWT Token with Spring Security OAuth2. Provides source code for Security implementation, controllers, services etc. Great read.
  • Spring Boot – Maven – OAuth2 – JWT – MySql
    • A Github project explaining Spring security Oauth2 and JWT implementation
  • Spring Security OAuth2 Implementation – BaelDung
Ajitesh Kumar

I have been recently working in the area of Data analytics including Data Science and Machine Learning / Deep Learning. I am also passionate about different technologies including programming languages such as Java/JEE, Javascript, Python, R, Julia, etc, and technologies such as Blockchain, mobile computing, cloud-native technologies, application security, cloud computing platforms, big data, etc. For latest updates and blogs, follow us on Twitter. I would love to connect with you on Linkedin. Check out my latest book titled as First Principles Thinking: Building winning products using first principles thinking. Check out my other blog, Revive-n-Thrive.com

Recent Posts

Autoencoder vs Variational Autoencoder (VAE): Differences

Last updated: 08th May, 2024 In the world of generative AI models, autoencoders (AE) and…

1 day ago

Linear Regression T-test: Formula, Example

Last updated: 7th May, 2024 Linear regression is a popular statistical method used to model…

2 days ago

Feature Engineering in Machine Learning: Python Examples

Last updated: 3rd May, 2024 Have you ever wondered why some machine learning models perform…

6 days ago

Feature Selection vs Feature Extraction: Machine Learning

Last updated: 2nd May, 2024 The success of machine learning models often depends on the…

1 week ago

Model Selection by Evaluating Bias & Variance: Example

When working on a machine learning project, one of the key challenges faced by data…

1 week ago

Bias-Variance Trade-off in Machine Learning: Examples

Last updated: 1st May, 2024 The bias-variance trade-off is a fundamental concept in machine learning…

1 week ago