Skip to content

mostrovoi/relevant-cover

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Relevant cover test

Requirements

Java (8+) installed

Git client (optional)

Curl or tool to make http requests e.g. postman, chrome browser, etc.

How to build it

Start by cloning this repository in your local machine git clone https://github.com/mostrovoi/relevant-cover.git

This project uses gradle as build tool. Go to relevant-cover folder and run ./gradlew bootRun

This will start up a server listening in port 8100

How to use it

This server is a sample test using JWT tokens as authentication mechanism for a REST api. There are 2 endpoints available

/login

/users/{username}

Login operation

You should POST a request to http://localhost:8100/login with your username and password in the body payload e.g with curl.:

curl -i -H "Content-Type: application/json" -X POST -d '{ "username": "xxxx", "password": "xxxx" }' http://localhost:8100/login

Where xxxx is your actual user and password. This operation, if succesful, will return a Bearer token in the response. This token should be used for all operations requiring authorization

Get a user

There is the endpoint /users/{username} which will retrieve the details of a user. e.g.:

curl -H "Authorization: Bearer xxx.yyy.zzz" http://localhost:8100/users/xxxx

Here, you should copy the token obtained before and replace xxx by the user you want to get info from.

Data

This demo uses an in-memory database already populated with 2 users:

user password
oscar oscar
bruno bruno

You can try out the demo with this data. Feedback welcome!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages