Skip to content

Java authentication and authorization with JwtToken example using Maven, Jersey, Hibernate and H2

License

Notifications You must be signed in to change notification settings

Petrakus/java-jwt-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

java-jwt-auth

Java authentication and authorization with JwtToken example using Maven, Jersey, Hibernate and H2

Getting started

First you need to have Maven installed then import the project as Maven project

Endpoints

/api/register - User registration. Method: POST

Request:

{
	"name":"Test",
	"email":"test@example.com",
	"password":"1234"
}

Response:

{
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1YTBlYTJjZmIwNzc0ODIwNjA0MjZmMDUiLCJpYXQiOjE1MTA5MDg2MjMsImV4cCI6MTUxMDk5NTAyM30.X5XDB6_m1R9P87ErslknRs1qP6gVV815HyPLPRrKP8s"
}

/api/login - User login. Method: POST

Request:

{
	"email":"test@example.com",
	"password":"1234"
}

Response:

{
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1YTBlYTJjZmIwNzc0ODIwNjA0MjZmMDUiLCJpYXQiOjE1MTA5MDg2MjMsImV4cCI6MTUxMDk5NTAyM30.X5XDB6_m1R9P87ErslknRs1qP6gVV815HyPLPRrKP8s"
}

/api/me - User details. Method: GET

Request:

Header:
authorization: <token>

Response:

{
    "id": 1,
    "name": "Test",
    "email": "test@example.com"
}

Built With

Authors

  • Petar Petrov - Initial work - Petrakus

See also the list of contributors who participated in this project.

About

Java authentication and authorization with JwtToken example using Maven, Jersey, Hibernate and H2

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published