jhipster / generator-jhipster-nodejs

A NodeJS blueprint that creates the backend using NestJS
https://www.npmjs.com/package/generator-jhipster-nodejs
Apache License 2.0
259 stars 80 forks source link

JWT Token Should bo Compatible with Jhipster (Java Version) #260

Open pietromarrone opened 2 years ago

pietromarrone commented 2 years ago

Describe the bug In a microservices architecture it is possible that some services are written in Java (JHipster) while others in NodeJs (NHipster), it would be advisable to have a compatible JWT Token. At the moment this does not happen, the token expected by NHipster is with HS256 encoding, even by changing this encoding to the token is not compatible as it differs in the authorities attribute name.

To Reproduce Steps to reproduce the behavior:

  1. Create Gateway with Jhipster Blueprint
  2. Create Microservice Application using NHipster blue print
  3. Authenticate with Gateway
  4. Use Generated JWT calling (Microservice Application using NHipster) protected api

Expected behavior Authentication/Authorizazion success

Screenshots

Desktop (please complete the following information):

NHipster configuration

ghost commented 2 years ago

Thanks for the issue! It is a feature that it would be great to implement. If you want to contribute, is simple.

 signOptions: {
            expiresIn: '3h',
            algorithm: 'HS512'
 }

You can do these changes on your microservice and after adding to the templates.

Thanks in advance