generator-jhipster
generator-jhipster copied to clipboard
Enrich user information results in NullPointerException if "preferred_username" is not existing
Overview of the issue
Every call to the Gateway results in a NullPointerException if claim do not contain the "preferred_username".
java.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "java.util.Map.get(Object)" is null
Motivation for or Use Case
Successfully call a route of the gateway
Reproduce the error
- Genrate a gateway project
- Call [gateway]/api/gateway/routes
Related issues
Suggest a Fix
https://github.com/jhipster/generator-jhipster/blob/main/generators/server/templates/src/main/java/package/config/SecurityConfiguration_reactive.java.ejs#L444
JHipster Version(s)
JHipster 7.9.2
JHipster configuration
{ "generator-jhipster": { "applicationType": "gateway", "authenticationType": "oauth2", "baseName": "gateway", "blueprints": [], "buildTool": "maven", "cacheProvider": "no", "clientFramework": "no", "clientPackageManager": "npm", "clientTheme": "none", "clientThemeVariant": "", "creationTimestamp": 1634563324703, "databaseType": "no", "devDatabaseType": "no", "devServerPort": 9060, "dtoSuffix": "DTO", "enableGradleEnterprise": false, "enableHibernateCache": false, "enableSwaggerCodegen": false, "enableTranslation": false, "entities": [], "entitySuffix": "", "jhiPrefix": "jhi", "jhipsterVersion": "7.9.2", "jwtSecretKey": "YourJWTSecretKeyWasReplacedByThisMeaninglessTextByTheJHipsterInfoCommandForObviousSecurityReasons", "languages": ["en", "fr"], "messageBroker": false, "nativeLanguage": "de", "otherModules": [], "packageName": "com.mycompany.myapp", "pages": [], "prodDatabaseType": "no", "reactive": true, "searchEngine": false, "serverPort": "8080", "serverSideOptions": [], "serviceDiscoveryType": "consul", "skipCheckLengthOfIdentifier": false, "skipClient": true, "skipFakeData": false, "skipServer": false, "skipUserManagement": true, "testFrameworks": [], "websocket": false, "withAdminUi": true } }
- [x] Checking this box is mandatory (this is just to show you read everything)
@lazyo666 What identity provider do you experience this with? I haven't seen it with Keycloak, Okta, or Auth0. Nevertheless, it's a worthwhile check. Can you please provide a PR?
I'll close this soon if no identity provider is provided.
Closing due to lack of response.