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

Administration Data Missing With OAuth Client Implementation #16704

Closed vw98075 closed 10 months ago

vw98075 commented 2 years ago
Overview of the issue

With OAuth client implementation, there is no data on the metrics, health, configuration, and logs pages while the Swagger page shows APIs as expected. Also, those management GET APIs yield blank responses.

Motivation for or Use Case

It is a bug due to missing data.

Reproduce the error
Related issues
Suggest a Fix

Show the data as what it is in a stand-alone web application.

JHipster Version(s)

7.2.0

JHipster configuration
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "baseName": "myapp",
    "jhipsterVersion": "7.2.0",
    "skipClient": false,
    "skipServer": false,
    "skipUserManagement": true,
    "skipCheckLengthOfIdentifier": false,
    "skipFakeData": false,
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "testFrameworks": ["cypress", "gatling"],
    "blueprints": [],
    "otherModules": [],
    "pages": [],
    "creationTimestamp": 1626276896721,
    "serviceDiscoveryType": false,
    "reactive": false,
    "authenticationType": "oauth2",
    "packageName": "com.mycompany.components.myapp",
    "serverPort": "8080",
    "cacheProvider": "ehcache",
    "enableHibernateCache": true,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "postgresql",
    "buildTool": "maven",
    "serverSideOptions": [],
    "websocket": false,
    "searchEngine": false,
    "messageBroker": false,
    "enableSwaggerCodegen": false,
    "clientFramework": "vue",
    "withAdminUi": true,
    "clientTheme": "cosmo",
    "clientThemeVariant": "primary",
    "enableTranslation": true,
    "nativeLanguage": "en",
    "packageFolder": "com/mycompany/components/myapp",
    "devServerPort": 9060,
    "clientPackageManager": "npm",
    "languages": ["en", "de"],
    "entities": ["Foo", "Boo", "Goo", "Reoo"],
    "lastLiquibaseTimestamp": 1634049322000,
    "enableGradleEnterprise": false
  }
}
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
vw98075 commented 2 years ago

After noticing the 403 error for those pages, I comment out

.antMatchers("/management/**").hasAuthority(AuthoritiesConstants.ADMIN)

in the SecurityConfiguration. All data shows up with an exception of Health after the change.

So, the ROLE_ADMIN DB hack works in some situations, but not others. Why?

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted. We are accepting PRs :smiley:. Comment or this will be closed in 7 days

mraible commented 2 years ago

I haven't seen this issue so I need to try and reproduce.

vw98075 commented 2 years ago

The OAuth2 client app still needs the administration section for admin users. It can be ported from a regular JHipster app with a few changes. For user management, we only make the Profiles/user role field editable due to lacking authorization support on the OAuth server.

mraible commented 2 years ago

I just created a screencast today of this blog post and the administration screen worked fine for me. I tested on Keycloak and Auth0.

Screen Shot 2021-12-17 at 16 45 52 Screen Shot 2021-12-17 at 16 46 09 Screen Shot 2021-12-17 at 16 46 13 Screen Shot 2021-12-17 at 16 46 22

I did not try your JDL, but I can do that when I get back from vacation in January.

vw98075 commented 2 years ago

Good to know your article. Did you have the administration section right out of the generator? If so, which version did you use? I used the 7.3.0 and didn't get the administration section (both front end and back end code) at all. And after porting the code from a non-OAuth app over, I don't have the health check data. The OAuth2 server isn't Keycloak. I don't know whether that is the cause of the problem or not,

DanielFran commented 2 years ago

@vw98075 To add in front-end the admin pages you need to launch jhipster with --with-admin-ui flag

This has been introduced in v7 (see https://github.com/jhipster/generator-jhipster/pull/12738)

vw98075 commented 2 years ago

@DanielFran I think you misunderstood the issue. It is not about whether the admin UI is generated or not, but some sections of the admin UI are missing.

github-actions[bot] commented 10 months ago

This issue is stale because it has been open for too long without any activity. Due to the moving nature of jhipster generated application, bugs can become invalid. If this issue still applies please comment otherwise it will be closed in 7 days