Twitter

miercuri, 29 iunie 2016

Using PrimeNG to authenticate via JWT to a container-less RestExpress microservice

We have two container-less microservices defined in RestExpress. The endpoints are:

AuthenticationService - this service respond to:
http://localhost:8587/clients.json - create a new client
http://localhost:8587/jwts.json?apiKey={apikey}&secret={password} - create a new JWT
http://localhost:8587/jwts/{jwt} - verify if a JWT is valid

SecretService - this service needs authentication and it respond to:
http://localhost:8086/secret/{secretid} - send a secret ID to the secret service

In order to run the app:

1. Download, install MongoDB - this is needed for storing the users
2. Start MongoDB and the AuthenticationService as in the README.txt file
3. Start SecretService as in the README.txt file
4. Run npm install and npm start from  the /PrimeNGandRestExpress/primengapp folder

Some screenshots:

Trying to access the SecretService without authentication:

Creating a new JWT:

Sending data to the SecretService after authentication:

The complete example is available here.

Niciun comentariu:

Trimiteți un comentariu