Spring Boot 3: Basic HTTP Authentication

Опубликовано: 27 Май 2026
на канале: PJL Software
396
12

When you add Spring Security or the Spring Boot Starter Security library to your Spring Boot 3 Java application, you can require basic HTTP authorization for all of your APIs with a simple configuration demoed here.

With HTTP basic authentication configured, you'll have to include the following header with your GET requests:

-H "Authorization: Basic base64Encoded('{username}:{password}' )"

The default Spring username is 'user' and the password will be auto-generated and printed to the screen when you start the Spring Boot application. Look for:

"Using generated security password: ..."