[Episode 35] Implementing HTTP Basic Authentication in Spring Boot

Published: 06 April 2023
on channel: Bingyang Wei
7,192
175

⚠️Update 1⚠️: At 4:42, the default password is removed in Spring Boot 3.2.0. Here is a brief summary:

Before 3.2.2:
If you added spring-boot-starter-security, and you didn’t configure any custom users, Spring Boot would automatically create an InMemoryUserDetailsManager with a default user and a random password. This happened no matter what, even if you were using OAuth2 or other security mechanisms.

After 3.2.2:
Spring Boot got smarter. It no longer auto-creates the in-memory user in some situations.
Specifically, if you're using any of these dependencies:
spring-security-oauth2-client
spring-security-oauth2-resource-server
spring-security-saml2-service-provider

More details: https://github.com/spring-projects/sp...

⚠️Update 2⚠️: At 17:50, headers.frameOptions() has been deprecated in favor of headers.frameOptions(Customizer.withDefaults()).

⚠️Update 3⚠️: At 17:03, In the latest Spring Boot, no need to use AntRequestPathMatcher. Simply: .requestMatchers("/h2-console/**").permitAll()

🔗 Spring Data JPA Query Methods: https://docs.spring.io/spring-data/jp...
🔗 Postman API collection: https://drive.google.com/file/d/1sjpc...

In this video, I implemented the HTTP Basic Authentication using Spring Security. The code is available at https://github.com/Washingtonwei/hogw...

Keep watching. Here are more Spring Security videos:
34 Introduction to Spring Security 🔗    • [Episode 34] Introduction to Spring Security  
35 Implementing HTTP Basic Authentication in Spring Boot 🔗    • [Episode 35] Implementing HTTP Basic Authe...  
36 Introduction to JWT 🔗    • [Episode 36] Introduction to JWT  
37 Generating JWTs in Spring Boot 🔗    • [Episode 37] Generating JWTs in Spring Boot  
38 Handling Spring Security Exceptions Using @ControllerAdvice🔗    • [Episode 38] Handling Spring Security Exce...  
39 Testing with Spring Security 🔗    • [Episode 39] Testing with Spring Security  
40 Enabling CORS in Spring Boot 🔗    • [Episode 40] Enabling CORS in Spring Boot  
41 Committing and Pushing to a GitHub Repo 🔗    • [Episode 41] Committing and Pushing to a G...  

This video belongs to a playlist "Learn Spring Boot 3 with Bingyang":    • Learn Spring Boot 3 with Bingyang  

I don't want to make a super long video so I split it into smaller ones. If you want to learn Spring Boot 3 systematically, please visit the playlist (and save the playlist) for more Spring Boot 3 tutorials.

Feel free to leave a comment if you have any questions.

As always, thanks for watching, and happy learning!


On this page of the site you can watch the video online [Episode 35] Implementing HTTP Basic Authentication in Spring Boot with a duration of hours minute second in good quality, which was uploaded by the user Bingyang Wei 06 April 2023, share the link with friends and acquaintances, this video has already been watched 7,192 times on youtube and it was liked by 175 viewers. Enjoy your viewing!