Skip to content

javascratches/jwt-rest-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JWT w Spring Boot 2.7

Kod do artykułu ze strony: https://javascratches.pl/jwt-w-spring-boot-2-7/

Aplikacja udostępnia dwa endpointy:

  1. Endpoint logowania do API /login
curl -i -X POST http://localhost:8080/login \
-H 'Content-Type: application/json' \
-d '{"username":"admin","password":"sekret2"}'
  1. Enpoint /hello wymagający autoryzacji. Zwraca prosty komunikat.
    W nagłówku Authorization: należy przekazać otrzymany token.
curl -i -X GET http://localhost:8080/hello \
  -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTY1MzgxNTgzOCwiaWF0IjoxNjUzODE1Nzc4fQ.1YfHz6jmjl1UsX3AGznMMJGxp4wtn7Y11ltSVquWBV0gGHRn7U1L686gWGJWSdmRiIisgizMmJXfBftFVPt_Lg'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages