jhipster / generator-jhipster-micronaut

Micronaut blueprint for JHipster
Apache License 2.0
99 stars 29 forks source link

Unable to log in to a new application with JWT authentication #418

Open mraible opened 5 hours ago

mraible commented 5 hours ago
Overview of the issue

If I generate an app with the following:

mhipster jdl default --skip-jhipster-dependencies

I'm unable to log in:

i.m.s.t.j.g.JwtTokenGenerator - JOSEException while generating token The secret length must be at least 256 bits
Reproduce the error
mhipster jdl default --skip-jhipster-dependencies
docker compose -f src/main/docker/services.yml up

Then, try to log in with admin/admin.

Related issues
Suggest a Fix
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "backendType": "micronaut",
    "baseName": "jhipster",
    "blueprints": [
      {
        "name": "generator-jhipster-micronaut",
        "version": "3.4.1"
      }
    ],
    "devServerPort": 4200,
    "entities": [],
    "jhipsterVersion": "8.7.3",
    "languages": [
      "en"
    ],
    "nativeLanguage": "en",
    "prodDatabaseType": "postgresql",
    "serverTestFrameworks": [],
    "skipJhipsterDependencies": true,
    "testFrameworks": [
      []
    ]
  }
}
Environment and Tools

openjdk version "17.0.13" 2024-10-15 OpenJDK Runtime Environment Temurin-17.0.13+11 (build 17.0.13+11) OpenJDK 64-Bit Server VM Temurin-17.0.13+11 (build 17.0.13+11, mixed mode, sharing)

git version 2.39.5 (Apple Git-154)

node: v20.18.0 npm: 10.9.0

Docker version 27.3.1, build ce12230

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions

mraible commented 5 hours ago

@mshima The value for the secret key seems wrong. From application-dev.yml:

  security:
    token:
      jwt:
        generator:
          access-token:
            expiration: 86400
        signatures:
          secret:
            generator:
              secret: ${jhipster.security.authentication.jwt.base64-secret:}