jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.5k stars 4.02k forks source link

Getting "403 Forbidden" on "/management/jhiopenapigroups" when using "serviceDiscoveryType": "eureka" and running the application from IDE #23382

Closed anothergoodguy closed 1 year ago

anothergoodguy commented 1 year ago
Overview of the issue

Hi Team, Greetings! Pre-note: Please note this issue is reproducible only with serviceDiscoveryType:eureka in the configuration. I am not sure to file it under jhipster-registery or generator-jhipster. Please advise if this belongs to jhipster-registery, I can refile there. Also not sure if this is a classpath issue or access issue.

I am using the attached .yo-rc.json file with "serviceDiscoveryType": "eureka". application compiles and runs perfectly without any error on both terminal with java -jar build/libs/store-0.0.1-SNAPSHOT.jar command and from the IDE intellij idea.

However, when running the generated application in the IDE intellij idea, log-in to the webapp, navigate to Administration --> API and you can only see a blank page with console errors on the browser (please see the attached screenshot). Interestingly I don't see any errors in the application's runtime console on the IDE.

I have tried to add the below lines on different / alternative runs to *basepackage.conf.SecurityConfiguration, but with no success.

.requestMatchers("/management/jhiopenapigroups").permitAll() .requestMatchers("/management/jhiopenapigroups").hasAuthority(AuthoritiesConstants.ADMIN)

image
Motivation for or Use Case

Running the application in the IDE will allow to debug the application flows on a rest API, swagger in JHispter has been a great value add to do the same.

Reproduce the error

Note: this doesn't happen if you build and run the application on a terminal.

Related issues

N/A

Suggest a Fix

I have tried to add the below lines on different / alternative runs to *basepackage.conf.SecurityConfiguration, but with no success:

Also tried adding the following line to *basepackage.web.filter.SpaWebFilter, with no success:

JHipster Version(s)

8.0.0-beta.2

JHipster configuration
    ██╗ ██╗   ██╗ ████████╗ ███████╗   ██████╗ ████████╗ ████████╗ ███████╗
    ██║ ██║   ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
    ██║ ████████║    ██║    ███████╔╝ ╚█████╗     ██║    ██████╗   ███████╔╝

██╗ ██║ ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║ ╚██████╔╝ ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗ ╚═════╝ ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝ https://www.jhipster.tech Welcome to JHipster v8.0.0-beta.2

store@0.0.1-SNAPSHOT /home/jhipster/app/biskate/tm-trial
└── generator-jhipster@8.0.0-beta.2
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "applicationType": "monolith",
  "authenticationType": "oauth2",
  "baseName": "store",
  "buildTool": "gradle",
  "cacheProvider": "infinispan",
  "clientFramework": "react",
  "clientTheme": "none",
  "creationTimestamp": 1693585493243,
  "databaseType": "sql",
  "devDatabaseType": "mysql",
  "devServerPort": 9060,
  "dtoSuffix": "DTO",
  "enableGradleEnterprise": null,
  "enableHibernateCache": true,
  "enableSwaggerCodegen": false,
  "enableTranslation": true,
  "entities": [],
  "entitySuffix": "",
  "gradleEnterpriseHost": null,
  "jhiPrefix": "jhi",
  "jhipsterVersion": "8.0.0-beta.2",
  "languages": [
    "en",
    "fr"
  ],
  "messageBroker": false,
  "microfrontend": false,
  "microfrontends": [],
  "nativeLanguage": "en",
  "packageFolder": "com/sample/platform",
  "packageName": "com.sample.platform",
  "pages": [],
  "pkType": "UUID",
  "prodDatabaseType": "mysql",
  "reactive": false,
  "searchEngine": "elasticsearch",
  "serverPort": 8081,
  "serverSideOptions": [
    "searchEngine:elasticsearch"
  ],
  "serviceDiscoveryType": "eureka",
  "skipCheckLengthOfIdentifier": false,
  "skipClient": false,
  "skipFakeData": false,
  "skipUserManagement": true,
  "testFrameworks": [],
  "websocket": false,
  "withAdminUi": true
}
Environment and Tools

openjdk version "17.0.7" 2023-04-18 OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7) OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode, sharing)

git version 2.25.1

node: v18.16.1 npm: 9.5.1

'docker' command could not be found

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

Entity configuration(s) entityName.json files generated in the .jhipster directory

Please note this issue occurs only with the combination of serviceDiscoveryType:eureka in the configuration and when we run the application from the IDE only.

Application generated with serviceDiscoveryType:false doesn't produce this issue.

Browsers and Operating System
anothergoodguy commented 1 year ago

One more additional question team:

I see the generator of v8 doesn't ask for options of Servcie Discovery for monolith generation and it recomends consul for microservice generation. Please advise if there are any plans to retire jhipster-registery in the future as it will have significant impact on the existing ecosystem to migrate to consul.

mshima commented 1 year ago

This issue is not reproducible. Works the endpoint works for ./gradlew and ./gradlew -Pprod -Papi-docs. You should make sure api-docs profile is enabled. In any case it's not related to jhipster, please post at stackoverflow.