Skip to content

cptdanko/custom-spring-boot-basic-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic auth in a Java Spring Boot app

This repo provides the code base for a Java Spring boot app with easy to understand code samples of how to implement basic authentication in a Java Spring boot application using Spring Security 6.

Libraries used

  1. Java 17
  2. Spring Boot 3.2.1
  3. Spring Security 6 and above
  4. Lombok 1.18.30

Setup and run repo

Clone the repo, go into the directory and run with M

git clone git@github.com:cptdanko/custom-spring-auth.git
cd custom-spring-boot-basic-auth
mvn spring-boot:run 

Once the spring-boot application is running, one of the ways you can test it is using Postman

  1. Launch Postman
  2. Import the Postman collection from the PostmanCollection folder of the repo
  3. Test the 3 API endpoints, of which
  4. Say Hello and Create User are the endpoints protected with basic auth
  5. Ping user is not secure and can be called without any credentials

How to change the default user?

To do so, change the username and password on line 47 of the SecurityConfig class in this repo.

Any help?

If you have difficulty understanding anything about this repo, feel free to reach out to me through this Github account or at bhuman@mydaytodo.com or bhuman.soni@gmail.com

More great tutorials and code samples

I will be writing a detailed tutorial on how to work with this repo on my blog. Until then refer to my blog for other tutorials and "how-to" articles with detailed code samples.

If you like what I am doing, you can buy me a coffee

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages