Skip to content

Latest commit

 

History

History
70 lines (50 loc) · 1.6 KB

README.md

File metadata and controls

70 lines (50 loc) · 1.6 KB

Authentication With SpringSecurity

Desafio

Authentication Logic with SpringBoot Security (using hard-coded users)

see this article Authentication and Authorization in Spring Boot 3.0 with Spring Security

System Users

  1. John

    • name: john
    • password: 2033
    • role: USER & ADMIN
  2. Maria

    • name: Maria
    • password: 3344
    • role: USER
  • Now, with that in mind you can perform request to the controller

How to Run

  • First you need to clone this to your machine
  git clone https://github.com/DevDario/basicAuth
  • Then access it
  cd basicAuth/
  • Now you can build the project:
$ ./mvnw clean package
  • and then run it:
$ java -jar target/basicAuth-0.0.1-SNAPSHOT.jar

You can access the API here: localhost:8080.

You will be redirected to the login form

You can also access the not-secure endpoint at: localhost:8080/welcome.

Endpoints (use a webclient,like a browser, to perform this requests)

$ http GET :8080/login

if you're already authenticated(as a USER) you can hit this URL:

$ http GET :8080/auth/user/userProfile

And if you're already authenticated(as a ADMIN) you can hit this URL:

$ http GET :8080/auth/admin/adminProfile