generator-jhipster 8.4.0 → 8.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generators/angular/resources/package.json +10 -10
- package/dist/generators/angular/templates/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.spec.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.ts.ejs +3 -6
- package/dist/generators/angular/templates/src/main/webapp/app/account/password-reset/init/password-reset-init.component.spec.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/account/password-reset/init/password-reset-init.component.ts.ejs +3 -6
- package/dist/generators/angular/templates/src/main/webapp/app/account/register/register.component.ts.ejs +3 -6
- package/dist/generators/angular/templates/src/main/webapp/app/admin/metrics/blocks/metrics-modal-threads/metrics-modal-threads.component.html.ejs +11 -11
- package/dist/generators/angular/templates/src/main/webapp/app/admin/user-management/delete/user-management-delete-dialog.component.html.ejs +0 -2
- package/dist/generators/angular/templates/src/main/webapp/app/core/auth/user-route-access.service.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/delete/_entityFile_-delete-dialog.component.html.ejs +0 -3
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/detail/_entityFile_-detail.component.spec.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/route/_entityFile_-routing-resolve.service.spec.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/update/_entityFile_-update.component.spec.ts.ejs +3 -3
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/update/_entityFile_-update.component.ts.ejs +11 -17
- package/dist/generators/angular/templates/src/main/webapp/app/layouts/navbar/active-menu.directive.ts.ejs +3 -3
- package/dist/generators/angular/templates/src/main/webapp/app/login/login.component.spec.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/login/login.component.ts.ejs +3 -4
- package/dist/generators/angular/templates/src/main/webapp/app/shared/alert/alert-error.component.spec.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/shared/auth/has-any-authority.directive.spec.ts.ejs +10 -8
- package/dist/generators/angular/templates/src/main/webapp/app/shared/auth/has-any-authority.directive.ts.ejs +3 -8
- package/dist/generators/angular/templates/src/main/webapp/app/shared/filter/filter.component.html.ejs +6 -2
- package/dist/generators/app/generator.js +4 -13
- package/dist/generators/base/generator.js +15 -16
- package/dist/generators/base/priorities.js +12 -1
- package/dist/generators/base-application/generator.js +14 -2
- package/dist/generators/base-application/priorities.js +1 -0
- package/dist/generators/base-application/support/prepare-entity.js +7 -8
- package/dist/generators/base-application/support/prepare-relationship.js +3 -2
- package/dist/generators/base-core/generator.js +40 -9
- package/dist/generators/bootstrap-application-base/generator.js +7 -3
- package/dist/generators/bootstrap-application-server/generator.js +1 -0
- package/dist/generators/client/command.js +2 -2
- package/dist/generators/client/generators/common/command.js +5 -0
- package/dist/generators/client/generators/common/generator.js +79 -0
- package/dist/generators/client/generators/common/index.js +20 -0
- package/dist/generators/client/generators/common/templates/src/main/webapp/app/shared/jhipster/headers.ts.ejs +57 -0
- package/dist/generators/client/generators/common/templates/src/main/webapp/app/shared/jhipster/problem-details.ts.ejs +51 -0
- package/dist/generators/client/resources/package.json +4 -4
- package/dist/generators/common/generator.js +5 -0
- package/dist/generators/common/resources/package.json +2 -2
- package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/account/login-page.cy.ts.ejs +4 -4
- package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/account/password-page.cy.ts.ejs +2 -2
- package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/account/register-page.cy.ts.ejs +1 -1
- package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/account/reset-password-page.cy.ts.ejs +1 -1
- package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/entity/_entity_.cy.ts.ejs +10 -10
- package/dist/generators/docker/templates/docker/mysql.yml.ejs +1 -1
- package/dist/generators/docker/templates/docker/realm-config/jhipster-realm.json.ejs +14 -3
- package/dist/generators/docker-compose/templates/realm-config/jhipster-realm.json.ejs +14 -3
- package/dist/generators/entity/generator.js +2 -10
- package/dist/generators/entity/prompts.js +6 -11
- package/dist/generators/gatling/README.md +15 -0
- package/dist/generators/gatling/templates/src/test/java/gatling/simulations/_entityClass_GatlingTest.java.ejs +2 -10
- package/dist/generators/generate-blueprint/command.js +16 -0
- package/dist/generators/generate-blueprint/files.js +8 -0
- package/dist/generators/generate-blueprint/generator.js +17 -10
- package/dist/generators/generate-blueprint/resources/package.json +1 -1
- package/dist/generators/generate-blueprint/templates/.blueprint/cli/commands.mjs.ejs +6 -0
- package/dist/generators/generate-blueprint/templates/.blueprint/generate-sample/command.mjs.ejs +20 -0
- package/dist/generators/generate-blueprint/templates/.blueprint/generate-sample/generator.mjs.ejs +9 -13
- package/dist/generators/generate-blueprint/templates/.blueprint/github-build-matrix/build-matrix.mjs.ejs +22 -0
- package/dist/generators/generate-blueprint/templates/.blueprint/github-build-matrix/generator.mjs.ejs +24 -0
- package/dist/generators/generate-blueprint/templates/.blueprint/github-build-matrix/index.mjs.ejs +1 -0
- package/dist/generators/generate-blueprint/templates/.eslintrc.json.ejs +2 -2
- package/dist/generators/generate-blueprint/templates/README.md.ejs +16 -8
- package/dist/generators/generate-blueprint/templates/vitest.config.ts.ejs +1 -0
- package/dist/generators/generator-constants.js +1 -1
- package/dist/generators/info/generator.js +1 -3
- package/dist/generators/init/generator.js +2 -2
- package/dist/generators/init/resources/.node-version +1 -1
- package/dist/generators/java/generators/build-tool/command.js +4 -1
- package/dist/generators/java/generators/domain/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.ejs +1 -5
- package/dist/generators/java/generators/domain/templates/src/test/java/_package_/_entityPackage_/domain/_persistClass_Asserts.java.ejs +3 -3
- package/dist/generators/java/generators/domain/templates/src/test/java/_package_/_entityPackage_/domain/_persistClass_Test.java.ejs +3 -3
- package/dist/generators/java/support/add-java-annotation.js +28 -7
- package/dist/generators/java/support/generated-annotation-transform.js +1 -1
- package/dist/generators/java/support/index.js +1 -1
- package/dist/generators/jdl/generator.js +1 -1
- package/dist/generators/kubernetes/files.js +1 -1
- package/dist/generators/kubernetes/templates/db/mysql.yml.ejs +0 -1
- package/dist/generators/kubernetes/templates/keycloak/keycloak-configmap.yml.ejs +14 -3
- package/dist/generators/languages/generator.js +4 -2
- package/dist/generators/maven/templates/.mvn/wrapper/maven-wrapper.properties +2 -2
- package/dist/generators/maven/templates/mvnw +185 -243
- package/dist/generators/maven/templates/mvnw.cmd +121 -180
- package/dist/generators/react/generator.js +10 -0
- package/dist/generators/react/resources/package.json +24 -24
- package/dist/generators/react/templates/src/main/webapp/app/config/axios-interceptor.spec.ts.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/config/axios-interceptor.ts.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/config/notification-middleware.spec.ts.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/config/notification-middleware.ts.ejs +80 -87
- package/dist/generators/react/templates/src/main/webapp/app/config/store.ts.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.tsx.ejs +3 -3
- package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.reducer.ts.ejs +12 -7
- package/dist/generators/react/templates/src/main/webapp/app/shared/reducers/reducer.utils.ts.ejs +2 -3
- package/dist/generators/server/command.js +0 -11
- package/dist/generators/server/generator.js +9 -70
- package/dist/generators/server/jdl/application-definition.js +3 -1
- package/dist/generators/server/resources/Dockerfile +12 -12
- package/dist/generators/server/resources/gradle/libs.versions.toml +7 -5
- package/dist/generators/server/resources/pom.xml +7 -7
- package/dist/generators/server/support/config.js +4 -8
- package/dist/generators/server/support/prepare-entity.js +5 -6
- package/dist/generators/server/support/relationship.js +5 -2
- package/dist/generators/server/templates/build.gradle.ejs +5 -3
- package/dist/generators/server/templates/gradle/profile_dev.gradle.ejs +1 -0
- package/dist/generators/server/templates/gradle/profile_prod.gradle.ejs +1 -0
- package/dist/generators/server/templates/gradle.properties.ejs +1 -1
- package/dist/generators/server/templates/pom.xml.ejs +7 -5
- package/dist/generators/server/templates/src/main/java/_package_/_entityPackage_/service/dto/_dtoClass_.java.ejs +1 -1
- package/dist/generators/server/templates/src/main/java/_package_/config/Constants.java.ejs +0 -2
- package/dist/generators/server/templates/src/main/java/_package_/config/SecurityConfiguration_imperative.java.ejs +1 -18
- package/dist/generators/server/templates/src/main/java/_package_/config/SecurityConfiguration_reactive.java.ejs +1 -15
- package/dist/generators/server/templates/src/main/java/_package_/config/SecurityJwtConfiguration.java.ejs +0 -20
- package/dist/generators/server/templates/src/main/java/_package_/security/SecurityUtils.java.ejs +65 -5
- package/dist/generators/server/templates/src/main/java/_package_/service/dto/UserDTO.java.ejs +23 -0
- package/dist/generators/server/templates/src/main/java/_package_/service/mapper/UserMapper.java.ejs +8 -4
- package/dist/generators/server/templates/src/main/java/_package_/web/rest/AccountResource_skipUserManagement.java.ejs +43 -9
- package/dist/generators/server/templates/src/main/resources/config/application.yml.ejs +59 -21
- package/dist/generators/server/templates/src/main/resources/swagger/api.yml.ejs +1 -1
- package/dist/generators/server/templates/src/test/java/_package_/security/DomainUserDetailsServiceIT.java.ejs +31 -13
- package/dist/generators/server/templates/src/test/java/_package_/service/mapper/UserMapperTest.java.ejs +84 -17
- package/dist/generators/server/templates/src/test/java/_package_/web/rest/AccountResourceIT.java.ejs +62 -6
- package/dist/generators/server/templates/src/test/java/_package_/web/rest/AccountResourceIT_oauth2.java.ejs +22 -0
- package/dist/generators/server/templates/src/test/resources/config/application.yml.ejs +20 -10
- package/dist/generators/spring-boot/command.js +117 -6
- package/dist/generators/spring-boot/files.js +0 -5
- package/dist/generators/spring-boot/generator.js +40 -7
- package/dist/generators/spring-boot/prompts.js +6 -70
- package/dist/generators/spring-boot/resources/spring-boot-dependencies.pom +368 -576
- package/dist/generators/spring-boot/templates/src/test/java/_package_/_entityPackage_/service/UserServiceIT.java.ejs +47 -11
- package/dist/generators/spring-boot/templates/src/test/java/_package_/_entityPackage_/web/rest/PublicUserResourceIT.java.ejs +60 -24
- package/dist/generators/spring-boot/templates/src/test/java/_package_/_entityPackage_/web/rest/UserResourceIT.java.ejs +195 -318
- package/dist/generators/spring-boot/templates/src/test/java/_package_/_entityPackage_/web/rest/_entityClass_ResourceIT.java.ejs +58 -51
- package/dist/generators/spring-cache/internal/dependencies.js +2 -2
- package/dist/generators/spring-cache/resources/gradle/libs.versions.toml +1 -1
- package/dist/generators/spring-cloud/generators/gateway/command.js +5 -1
- package/dist/generators/spring-cloud/generators/gateway/generator.js +13 -0
- package/dist/generators/spring-cloud/generators/gateway/jdl/jdl-routes-option.js +6 -0
- package/dist/generators/spring-data-cassandra/generator.js +2 -2
- package/dist/generators/spring-data-relational/templates/src/test/java/_package_/config/SqlTestContainersSpringContextCustomizerFactory.java.ejs +3 -1
- package/dist/generators/vue/resources/package.json +15 -15
- package/dist/generators/vue/templates/src/main/webapp/app/admin/tracker/tracker.service.spec.ts.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-details.vue.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.vue.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.vue.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/shared/alert/alert.service.spec.ts.ejs +8 -8
- package/dist/generators/vue/templates/src/main/webapp/app/shared/data/data-utils.service.spec.ts.ejs +1 -1
- package/dist/generators/vue/templates/tsconfig.app.json.ejs +1 -1
- package/dist/generators/vue/templates/vite.config.mts.ejs +5 -4
- package/dist/jdl/converters/jdl-to-json/jdl-to-json-basic-entity-converter.js +1 -1
- package/dist/jdl/converters/jdl-to-json/jdl-to-json-field-converter.js +4 -4
- package/dist/jdl/converters/jdl-to-json/jdl-with-applications-to-json-converter.js +9 -9
- package/dist/jdl/converters/jdl-to-json/jdl-without-application-to-json-converter.js +2 -2
- package/dist/jdl/converters/json-to-jdl-application-converter.js +1 -1
- package/dist/jdl/converters/json-to-jdl-converter.js +6 -5
- package/dist/jdl/converters/json-to-jdl-entity-converter.js +14 -14
- package/dist/jdl/converters/json-to-jdl-option-converter.js +1 -2
- package/dist/jdl/converters/parsed-jdl-to-jdl-object/application-converter.js +1 -1
- package/dist/jdl/converters/parsed-jdl-to-jdl-object/option-converter.js +2 -2
- package/dist/jdl/converters/parsed-jdl-to-jdl-object/parsed-jdl-to-jdl-object-converter.js +7 -6
- package/dist/jdl/converters/parsed-jdl-to-jdl-object/validation-converter.js +1 -1
- package/dist/jdl/exporters/applications/jhipster-application-formatter.js +16 -23
- package/dist/jdl/exporters/config.js +1 -0
- package/dist/jdl/exporters/jhipster-deployment-exporter.js +5 -5
- package/dist/jdl/exporters/jhipster-entity-exporter.js +1 -1
- package/dist/jdl/jdl-importer.js +22 -20
- package/dist/jdl/jhipster/binary-options.js +12 -8
- package/dist/jdl/jhipster/json-entity.js +1 -1
- package/dist/jdl/models/abstract-jdl-option.js +2 -2
- package/dist/jdl/models/jdl-application-configuration-factory.js +2 -0
- package/dist/jdl/models/jdl-binary-option.js +2 -2
- package/dist/jdl/models/jdl-deployment.js +11 -0
- package/dist/jdl/models/jdl-entity.js +1 -1
- package/dist/jdl/models/jdl-enum.js +1 -1
- package/dist/jdl/models/jdl-enums.js +0 -18
- package/dist/jdl/models/jdl-field.js +2 -2
- package/dist/jdl/models/jdl-object-wrapper.js +1 -0
- package/dist/jdl/models/jdl-object.js +23 -45
- package/dist/jdl/models/jdl-options.js +0 -18
- package/dist/jdl/models/jdl-relationships.js +8 -16
- package/dist/jdl/models/jdl-unary-option.js +1 -1
- package/dist/jdl/models/list-jdl-application-configuration-option.js +5 -2
- package/dist/jdl/parsing/jdl-ast-builder-visitor.js +12 -0
- package/dist/jdl/parsing/jdl-parser.js +14 -0
- package/dist/jdl/parsing/lexer/lexer.js +17 -11
- package/dist/jdl/parsing/validator.js +16 -2
- package/dist/jdl/readers/json-reader.js +1 -1
- package/dist/jdl/utils/array-utils.js +6 -0
- package/dist/jdl/utils/set-utils.js +3 -2
- package/dist/jdl/validators/jdl-without-application-validator.js +2 -2
- package/dist/testing/helpers.js +4 -0
- package/dist/types/generators/base/api.d.ts +5 -1
- package/dist/types/generators/base/generator.d.ts +10 -4
- package/dist/types/generators/base/priorities.d.ts +4 -0
- package/dist/types/generators/base/shared-data.d.ts +1 -1
- package/dist/types/generators/base-application/priorities.d.ts +2 -0
- package/dist/types/generators/base-application/support/entity.d.ts +2 -2
- package/dist/types/generators/base-application/support/prepare-entity.d.ts +3 -3
- package/dist/types/generators/base-application/support/relationship.d.ts +5 -5
- package/dist/types/generators/base-core/generator.d.ts +16 -1
- package/dist/types/generators/generator-constants.d.ts +1 -1
- package/dist/types/generators/java/support/add-java-annotation.d.ts +10 -20
- package/dist/types/generators/java/support/doc.d.ts +1 -1
- package/dist/types/generators/java/support/index.d.ts +1 -1
- package/dist/types/generators/server/support/relationship.d.ts +2 -2
- package/dist/types/generators/server/types.d.ts +5 -0
- package/dist/types/generators/spring-cloud/generators/gateway/jdl/jdl-routes-option.d.ts +2 -0
- package/dist/types/generators/spring-cloud/generators/gateway/types.d.ts +4 -0
- package/dist/types/jdl/converters/jdl-to-json/jdl-to-json-field-converter.d.ts +2 -2
- package/dist/types/jdl/converters/jdl-to-json/jdl-with-applications-to-json-converter.d.ts +2 -1
- package/dist/types/jdl/converters/jdl-to-json/jdl-without-application-to-json-converter.d.ts +3 -1
- package/dist/types/jdl/converters/json-to-jdl-application-converter.d.ts +9 -2
- package/dist/types/jdl/converters/json-to-jdl-converter.d.ts +3 -3
- package/dist/types/jdl/converters/json-to-jdl-entity-converter.d.ts +2 -4
- package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/application-converter.d.ts +3 -1
- package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/deployment-converter.d.ts +2 -1
- package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/entity-converter.d.ts +3 -1
- package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/enum-converter.d.ts +2 -1
- package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/field-converter.d.ts +2 -1
- package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/option-converter.d.ts +3 -3
- package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/parsed-jdl-to-jdl-object-converter.d.ts +2 -1
- package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/relationship-converter.d.ts +2 -1
- package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/types.d.ts +110 -0
- package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/validation-converter.d.ts +2 -1
- package/dist/types/jdl/converters/types.d.ts +102 -14
- package/dist/types/jdl/exporters/applications/jhipster-application-formatter.d.ts +4 -4
- package/dist/types/jdl/exporters/config.d.ts +2 -1
- package/dist/types/jdl/exporters/export-utils.d.ts +2 -1
- package/dist/types/jdl/exporters/jdl-exporter.d.ts +2 -1
- package/dist/types/jdl/exporters/jhipster-deployment-exporter.d.ts +3 -1
- package/dist/types/jdl/exporters/jhipster-entity-exporter.d.ts +3 -1
- package/dist/types/jdl/exporters/types.d.ts +61 -0
- package/dist/types/jdl/jhipster/binary-options.d.ts +8 -26
- package/dist/types/jdl/jhipster/field-types.d.ts +2 -2
- package/dist/types/jdl/jhipster/json-entity.d.ts +2 -2
- package/dist/types/jdl/models/abstract-jdl-option.d.ts +14 -9
- package/dist/types/jdl/models/boolean-jdl-application-configuration-option.d.ts +1 -1
- package/dist/types/jdl/models/integer-jdl-application-configuration-option.d.ts +1 -1
- package/dist/types/jdl/models/jdl-application-configuration-factory.d.ts +1 -1
- package/dist/types/jdl/models/jdl-application-configuration-option.d.ts +4 -4
- package/dist/types/jdl/models/jdl-application-configuration.d.ts +4 -4
- package/dist/types/jdl/models/jdl-application-definition.d.ts +4 -4
- package/dist/types/jdl/models/jdl-application-entities.d.ts +4 -4
- package/dist/types/jdl/models/jdl-application.d.ts +16 -13
- package/dist/types/jdl/models/jdl-binary-option.d.ts +5 -3
- package/dist/types/jdl/models/jdl-deployment.d.ts +13 -1
- package/dist/types/jdl/models/jdl-entity.d.ts +5 -5
- package/dist/types/jdl/models/jdl-enum-value.d.ts +4 -4
- package/dist/types/jdl/models/jdl-enum.d.ts +9 -5
- package/dist/types/jdl/models/jdl-enums.d.ts +6 -5
- package/dist/types/jdl/models/jdl-field.d.ts +10 -8
- package/dist/types/jdl/models/jdl-object-wrapper.d.ts +25 -0
- package/dist/types/jdl/models/jdl-object.d.ts +23 -19
- package/dist/types/jdl/models/jdl-options.d.ts +7 -24
- package/dist/types/jdl/models/jdl-relationship.d.ts +16 -10
- package/dist/types/jdl/models/jdl-relationships.d.ts +5 -5
- package/dist/types/jdl/models/jdl-validation.d.ts +3 -3
- package/dist/types/jdl/models/list-jdl-application-configuration-option.d.ts +4 -3
- package/dist/types/jdl/models/string-jdl-application-configuration-option.d.ts +2 -2
- package/dist/types/jdl/parsing/jdl-ast-builder-visitor.d.ts +1 -0
- package/dist/types/jdl/parsing/jdl-parser.d.ts +1 -0
- package/dist/types/jdl/parsing/jdl-parsing-types.d.ts +23 -0
- package/dist/types/jdl/parsing/lexer/lexer.d.ts +6 -2
- package/dist/types/jdl/parsing/validator.d.ts +1 -1
- package/dist/types/jdl/utils/array-utils.d.ts +1 -0
- package/dist/types/jdl/utils/set-utils.d.ts +1 -19
- package/dist/types/jdl/validators/deployment-validator.d.ts +2 -1
- package/dist/types/testing/helpers.d.ts +13 -3
- package/package.json +24 -23
- /package/dist/jdl/converters/{types.js → parsed-jdl-to-jdl-object/types.js} +0 -0
|
@@ -3,18 +3,14 @@ import { databaseTypes, monitoringTypes, authenticationTypes, buildToolTypes, ca
|
|
|
3
3
|
import { prepareSqlApplicationProperties } from '../../spring-data-relational/support/index.js';
|
|
4
4
|
import { CLIENT_DIST_DIR, CLIENT_MAIN_SRC_DIR, CLIENT_TEST_SRC_DIR, SERVER_MAIN_RES_DIR, SERVER_MAIN_SRC_DIR, SERVER_TEST_RES_DIR, SERVER_TEST_SRC_DIR, } from '../../generator-constants.js';
|
|
5
5
|
import { MESSAGE_BROKER_KAFKA, MESSAGE_BROKER_NO, MESSAGE_BROKER_PULSAR } from '../../server/options/index.js';
|
|
6
|
-
const { SQL, MONGODB, COUCHBASE, NEO4J, CASSANDRA } = databaseTypes;
|
|
7
|
-
const NO_DATABASE = databaseTypes.NO;
|
|
6
|
+
const { NO: NO_DATABASE, SQL, MONGODB, COUCHBASE, NEO4J, CASSANDRA } = databaseTypes;
|
|
8
7
|
const { PROMETHEUS, ELK } = monitoringTypes;
|
|
9
8
|
const { OAUTH2, SESSION } = authenticationTypes;
|
|
10
|
-
const { CAFFEINE, EHCACHE, REDIS, HAZELCAST, INFINISPAN, MEMCACHED } = cacheTypes;
|
|
9
|
+
const { NO: NO_CACHE, CAFFEINE, EHCACHE, REDIS, HAZELCAST, INFINISPAN, MEMCACHED } = cacheTypes;
|
|
11
10
|
const { GRADLE, MAVEN } = buildToolTypes;
|
|
12
11
|
const { SPRING_WEBSOCKET } = websocketTypes;
|
|
13
|
-
const { CONSUL, EUREKA } = serviceDiscoveryTypes;
|
|
14
|
-
const { ELASTICSEARCH } = searchEngineTypes;
|
|
15
|
-
const NO_CACHE = cacheTypes.NO;
|
|
16
|
-
const NO_SERVICE_DISCOVERY = serviceDiscoveryTypes.NO;
|
|
17
|
-
const NO_SEARCH_ENGINE = searchEngineTypes.NO;
|
|
12
|
+
const { NO: NO_SERVICE_DISCOVERY, CONSUL, EUREKA } = serviceDiscoveryTypes;
|
|
13
|
+
const { NO: NO_SEARCH_ENGINE, ELASTICSEARCH } = searchEngineTypes;
|
|
18
14
|
/**
|
|
19
15
|
* Load server configs into application.
|
|
20
16
|
* all variables should be set to dest,
|
|
@@ -23,9 +23,8 @@ import { mutateData, normalizePathEnd } from '../../base/support/index.js';
|
|
|
23
23
|
import { hibernateSnakeCase } from './string.js';
|
|
24
24
|
import { getDatabaseTypeData } from './database.js';
|
|
25
25
|
import { formatDocAsApiDescription, formatDocAsJavaDoc } from '../../java/support/doc.js';
|
|
26
|
-
const { ELASTICSEARCH } = searchEngineTypes;
|
|
27
|
-
const
|
|
28
|
-
const { POSTGRESQL, MYSQL, MARIADB, COUCHBASE, SQL } = databaseTypes;
|
|
26
|
+
const { NO: NO_SEARCH_ENGINE, ELASTICSEARCH } = searchEngineTypes;
|
|
27
|
+
const { POSTGRESQL, MYSQL, MARIADB, COUCHBASE, SQL, NEO4J } = databaseTypes;
|
|
29
28
|
export default function prepareEntity(entity) {
|
|
30
29
|
const { entityPackage, packageName, packageFolder, persistClass } = entity;
|
|
31
30
|
let { entityAbsolutePackage = packageName, entityAbsoluteFolder = packageFolder, entityJavaPackageFolder } = entity;
|
|
@@ -81,9 +80,9 @@ export function preparePostEntityServerDerivedProperties(entity) {
|
|
|
81
80
|
.filter(relationship => relationship.ignoreOtherSideProperty === undefined)
|
|
82
81
|
.forEach(relationship => {
|
|
83
82
|
relationship.ignoreOtherSideProperty =
|
|
84
|
-
entity.databaseType !==
|
|
85
|
-
!
|
|
86
|
-
|
|
83
|
+
entity.databaseType !== NEO4J &&
|
|
84
|
+
!entity.embedded &&
|
|
85
|
+
!relationship.otherEntity.embedded &&
|
|
87
86
|
relationship.otherEntity.relationships.length > 0;
|
|
88
87
|
});
|
|
89
88
|
entity.relationshipsContainOtherSideIgnore = entity.relationships.some(relationship => relationship.ignoreOtherSideProperty);
|
|
@@ -17,17 +17,20 @@
|
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { addOtherRelationship } from '../../base-application/support/index.js';
|
|
20
|
+
import { databaseTypes } from '../../../jdl/index.js';
|
|
21
|
+
const { NO: NO_DATABASE, SQL, NEO4J } = databaseTypes;
|
|
20
22
|
// eslint-disable-next-line import/prefer-default-export
|
|
21
23
|
export const addEntitiesOtherRelationships = (entities) => {
|
|
22
24
|
const result = { warning: [] };
|
|
23
25
|
for (const entity of entities.filter(entity => !entity.builtIn)) {
|
|
24
26
|
for (const relationship of entity.relationships ?? []) {
|
|
25
27
|
if (!relationship.otherRelationship &&
|
|
28
|
+
!relationship.otherEntity.embedded &&
|
|
26
29
|
(relationship.otherEntityRelationshipName ||
|
|
27
30
|
relationship.relationshipType === 'many-to-many' ||
|
|
28
31
|
// OneToOne back reference is required due to filtering
|
|
29
|
-
(relationship.relationshipType === 'one-to-one' && entity.databaseType ===
|
|
30
|
-
(relationship.relationshipType === 'one-to-many' && entity.databaseType !==
|
|
32
|
+
(relationship.relationshipType === 'one-to-one' && entity.databaseType === SQL) ||
|
|
33
|
+
(relationship.relationshipType === 'one-to-many' && entity.databaseType !== NEO4J && entity.databaseType !== NO_DATABASE))) {
|
|
31
34
|
if (relationship.otherEntity.builtIn) {
|
|
32
35
|
result.warning.push(`Ignoring '${entity.name}' definitions as it is using a built-in Entity '${relationship.otherEntityName}': 'otherEntityRelationshipName' is set with value '${relationship.otherEntityRelationshipName}' at relationship '${relationship.relationshipName}' but no back-reference was found`);
|
|
33
36
|
}
|
|
@@ -124,6 +124,7 @@ test {
|
|
|
124
124
|
// see https://github.com/jhipster/generator-jhipster/pull/2771 and https://github.com/jhipster/generator-jhipster/pull/4484
|
|
125
125
|
// ignoreFailures true
|
|
126
126
|
reports.html.required = false
|
|
127
|
+
testLogging.exceptionFormat "full"
|
|
127
128
|
<%_ if (reactive) { _%>
|
|
128
129
|
|
|
129
130
|
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_13)) {
|
|
@@ -134,7 +135,6 @@ test {
|
|
|
134
135
|
<%_ } _%>
|
|
135
136
|
}
|
|
136
137
|
|
|
137
|
-
|
|
138
138
|
check.dependsOn integrationTest
|
|
139
139
|
task testReport(type: TestReport) {
|
|
140
140
|
destinationDirectory = file("$buildDir/reports/tests")
|
|
@@ -172,8 +172,7 @@ dependencies {
|
|
|
172
172
|
testRuntimeOnly("com.tngtech.archunit:archunit-junit5-engine:${archunitJunit5Version}") {
|
|
173
173
|
exclude group: "org.slf4j", module: "slf4j-api"
|
|
174
174
|
}
|
|
175
|
-
implementation "io.
|
|
176
|
-
implementation "io.micrometer:micrometer-registry-prometheus"
|
|
175
|
+
implementation "io.micrometer:micrometer-registry-prometheus-simpleclient"
|
|
177
176
|
<%_ if (reactive) { _%>
|
|
178
177
|
runtimeOnly "io.netty:netty-tcnative-boringssl-static"
|
|
179
178
|
<%_ } _%>
|
|
@@ -237,6 +236,9 @@ if (addSpringMilestoneRepository) { _%>
|
|
|
237
236
|
<%_ if (serviceDiscoveryAny && serviceDiscoveryEureka) { _%>
|
|
238
237
|
implementation "org.springframework.cloud:spring-cloud-starter-config"
|
|
239
238
|
<%_ } _%>
|
|
239
|
+
<%_ if (applicationTypeGateway && !reactive) { _%>
|
|
240
|
+
implementation "org.springframework.cloud:spring-cloud-starter-loadbalancer"
|
|
241
|
+
<%_ } _%>
|
|
240
242
|
<%_ if (serviceDiscoveryAny && serviceDiscoveryConsul) { _%>
|
|
241
243
|
implementation "org.springframework.cloud:spring-cloud-starter-consul-config"
|
|
242
244
|
<%_ } _%>
|
|
@@ -32,7 +32,7 @@ blockhoundJunitPlatformVersion=<%- javaDependencies['blockhound-junit-platform']
|
|
|
32
32
|
# gradle plugin version
|
|
33
33
|
gitPropertiesPluginVersion=<%- javaDependencies['gradle-git-properties'] %>
|
|
34
34
|
<%_ if (enableSwaggerCodegen) { _%>
|
|
35
|
-
openapiPluginVersion=<%- javaDependencies['openapi-generator
|
|
35
|
+
openapiPluginVersion=<%- javaDependencies['gradle-openapi-generator'] %>
|
|
36
36
|
<%_ } _%>
|
|
37
37
|
<%_ if (enableGradleEnterprise) { _%>
|
|
38
38
|
gradleEnterprisePluginVersion=<%- javaDependencies['gradle-enterprise'] %>
|
|
@@ -113,10 +113,6 @@
|
|
|
113
113
|
<version>${archunit-junit5.version}</version>
|
|
114
114
|
<scope>test</scope>
|
|
115
115
|
</dependency>
|
|
116
|
-
<dependency>
|
|
117
|
-
<groupId>io.dropwizard.metrics</groupId>
|
|
118
|
-
<artifactId>metrics-core</artifactId>
|
|
119
|
-
</dependency>
|
|
120
116
|
<%_ if (reactive) { _%>
|
|
121
117
|
<dependency>
|
|
122
118
|
<groupId>io.micrometer</groupId>
|
|
@@ -126,7 +122,7 @@
|
|
|
126
122
|
<%_ } _%>
|
|
127
123
|
<dependency>
|
|
128
124
|
<groupId>io.micrometer</groupId>
|
|
129
|
-
<artifactId>micrometer-registry-prometheus</artifactId>
|
|
125
|
+
<artifactId>micrometer-registry-prometheus-simpleclient</artifactId>
|
|
130
126
|
</dependency>
|
|
131
127
|
<%_ if (reactive) { _%>
|
|
132
128
|
<dependency>
|
|
@@ -282,6 +278,12 @@
|
|
|
282
278
|
<artifactId>spring-cloud-starter-config</artifactId>
|
|
283
279
|
</dependency>
|
|
284
280
|
<%_ } _%>
|
|
281
|
+
<%_ if (applicationTypeGateway && !reactive) { _%>
|
|
282
|
+
<dependency>
|
|
283
|
+
<groupId>org.springframework.cloud</groupId>
|
|
284
|
+
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
|
285
|
+
</dependency>
|
|
286
|
+
<%_ } _%>
|
|
285
287
|
<%_ if (serviceDiscoveryAny && serviceDiscoveryConsul) { _%>
|
|
286
288
|
<dependency>
|
|
287
289
|
<groupId>org.springframework.cloud</groupId>
|
|
@@ -88,7 +88,7 @@ public class <%- dtoClass %> implements Serializable {
|
|
|
88
88
|
@NotNull
|
|
89
89
|
<%_ } _%>
|
|
90
90
|
<%_ if (property.propertyApiDescription) { _%>
|
|
91
|
-
@Schema(description = "<%- property.propertyApiDescription %>"<% if (required) { %>,
|
|
91
|
+
@Schema(description = "<%- property.propertyApiDescription %>"<% if (required) { %>, requiredMode = Schema.RequiredMode.REQUIRED<% } %>)
|
|
92
92
|
<%_ } _%>
|
|
93
93
|
<%_ if (property.fieldTypeBytes && databaseTypeSql) { _%>
|
|
94
94
|
@Lob
|
|
@@ -31,9 +31,7 @@ public final class Constants {
|
|
|
31
31
|
<%_ if (generateBuiltInUserEntity || databaseTypeSql || databaseTypeMongodb || databaseTypeCouchbase) { _%>
|
|
32
32
|
public static final String SYSTEM = "system";
|
|
33
33
|
<%_ } _%>
|
|
34
|
-
<%_ if (generateUserManagement || authenticationTypeOauth2) { _%>
|
|
35
34
|
public static final String DEFAULT_LANGUAGE = "<%= nativeLanguage %>";
|
|
36
|
-
<%_ } _%>
|
|
37
35
|
<%_ if (databaseTypeCouchbase) { _%>
|
|
38
36
|
public static final String ID_DELIMITER = "__";
|
|
39
37
|
<%_ } _%>
|
|
@@ -27,9 +27,6 @@ import static org.springframework.security.web.util.matcher.AntPathRequestMatche
|
|
|
27
27
|
<%_ } _%>
|
|
28
28
|
import org.springframework.context.annotation.Bean;
|
|
29
29
|
import org.springframework.context.annotation.Configuration;
|
|
30
|
-
<%_ if (authenticationTypeOauth2) { _%>
|
|
31
|
-
import org.springframework.core.convert.converter.Converter;
|
|
32
|
-
<%_ } _%>
|
|
33
30
|
<%_ if (devDatabaseTypeH2Any) { _%>
|
|
34
31
|
import org.springframework.core.env.Environment;
|
|
35
32
|
import org.springframework.core.env.Profiles;
|
|
@@ -70,7 +67,6 @@ import static org.springframework.security.oauth2.core.oidc.StandardClaimNames.P
|
|
|
70
67
|
|
|
71
68
|
import <%= packageName %>.security.oauth2.AudienceValidator;
|
|
72
69
|
import <%= packageName %>.security.SecurityUtils;
|
|
73
|
-
import org.springframework.security.authentication.AbstractAuthenticationToken;
|
|
74
70
|
import org.springframework.security.oauth2.client.userinfo.OAuth2UserService;
|
|
75
71
|
import org.springframework.security.oauth2.client.oidc.userinfo.OidcUserRequest;
|
|
76
72
|
import org.springframework.security.oauth2.client.oidc.userinfo.OidcUserService;
|
|
@@ -79,7 +75,6 @@ import org.springframework.security.oauth2.core.OAuth2TokenValidator;
|
|
|
79
75
|
import org.springframework.security.oauth2.core.oidc.user.DefaultOidcUser;
|
|
80
76
|
import org.springframework.security.oauth2.core.oidc.user.OidcUser;
|
|
81
77
|
import org.springframework.security.oauth2.jwt.*;
|
|
82
|
-
import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationConverter;
|
|
83
78
|
import org.springframework.beans.factory.annotation.Value;
|
|
84
79
|
import org.springframework.security.core.GrantedAuthority;
|
|
85
80
|
<%_ if (!applicationTypeMicroservice) { _%>
|
|
@@ -103,9 +98,6 @@ import org.springframework.security.web.authentication.RememberMeServices;
|
|
|
103
98
|
<%_ if (authenticationUsesCsrf && !applicationTypeMicroservice) { _%>
|
|
104
99
|
import org.springframework.security.web.csrf.*;
|
|
105
100
|
<%_ } _%>
|
|
106
|
-
<%_ if (authenticationTypeOauth2) { _%>
|
|
107
|
-
import <%= packageName %>.security.oauth2.JwtGrantedAuthorityConverter;
|
|
108
|
-
<%_ } _%>
|
|
109
101
|
<%_ if (authenticationTypeJwt) { _%>
|
|
110
102
|
import org.springframework.security.oauth2.server.resource.web.BearerTokenAuthenticationEntryPoint;
|
|
111
103
|
import org.springframework.security.oauth2.server.resource.web.access.BearerTokenAccessDeniedHandler;
|
|
@@ -292,9 +284,7 @@ public class SecurityConfiguration {
|
|
|
292
284
|
<%_ } else { _%>
|
|
293
285
|
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
|
294
286
|
<%_ } _%>
|
|
295
|
-
.oauth2ResourceServer(oauth2 -> oauth2
|
|
296
|
-
.jwt(jwt -> jwt
|
|
297
|
-
.jwtAuthenticationConverter(authenticationConverter())))
|
|
287
|
+
.oauth2ResourceServer(oauth2 -> oauth2.jwt(withDefaults()))
|
|
298
288
|
.oauth2Client(withDefaults());
|
|
299
289
|
<%_ } _%>
|
|
300
290
|
<%_ if (devDatabaseTypeH2Any) { _%>
|
|
@@ -315,13 +305,6 @@ public class SecurityConfiguration {
|
|
|
315
305
|
}
|
|
316
306
|
<%_ if (authenticationTypeOauth2) { _%>
|
|
317
307
|
|
|
318
|
-
Converter<Jwt, AbstractAuthenticationToken> authenticationConverter() {
|
|
319
|
-
JwtAuthenticationConverter jwtAuthenticationConverter = new JwtAuthenticationConverter();
|
|
320
|
-
jwtAuthenticationConverter.setJwtGrantedAuthoritiesConverter(new JwtGrantedAuthorityConverter());
|
|
321
|
-
jwtAuthenticationConverter.setPrincipalClaimName(PREFERRED_USERNAME);
|
|
322
|
-
return jwtAuthenticationConverter;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
308
|
OAuth2UserService<OidcUserRequest, OidcUser> oidcUserService() {
|
|
326
309
|
final OidcUserService delegate = new OidcUserService();
|
|
327
310
|
|
|
@@ -24,9 +24,6 @@ import static org.springframework.security.oauth2.core.oidc.StandardClaimNames.P
|
|
|
24
24
|
|
|
25
25
|
import <%= packageName %>.security.SecurityUtils;
|
|
26
26
|
import <%= packageName %>.security.oauth2.AudienceValidator;
|
|
27
|
-
import <%= packageName %>.security.oauth2.JwtGrantedAuthorityConverter;
|
|
28
|
-
import org.springframework.security.authentication.AbstractAuthenticationToken;
|
|
29
|
-
import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationConverter;
|
|
30
27
|
import org.springframework.beans.factory.annotation.Value;
|
|
31
28
|
<%_ } _%>
|
|
32
29
|
<%_ if (authenticationUsesCsrf) { _%>
|
|
@@ -42,7 +39,6 @@ import <%= packageName %>.web.filter.SpaWebFilter;
|
|
|
42
39
|
import org.springframework.context.annotation.Bean;
|
|
43
40
|
import org.springframework.context.annotation.Configuration;
|
|
44
41
|
<%_ if (authenticationTypeOauth2) { _%>
|
|
45
|
-
import org.springframework.core.convert.converter.Converter;
|
|
46
42
|
<%_ if (!applicationTypeMicroservice) { _%>
|
|
47
43
|
import org.springframework.core.ParameterizedTypeReference;
|
|
48
44
|
<%_ } _%>
|
|
@@ -81,7 +77,6 @@ import org.springframework.security.oauth2.core.oidc.user.DefaultOidcUser;
|
|
|
81
77
|
import org.springframework.security.oauth2.core.oidc.user.OidcUser;
|
|
82
78
|
import org.springframework.security.oauth2.core.oidc.user.OidcUserAuthority;
|
|
83
79
|
import org.springframework.security.oauth2.jwt.*;
|
|
84
|
-
import org.springframework.security.oauth2.server.resource.authentication.ReactiveJwtAuthenticationConverterAdapter;
|
|
85
80
|
<%_ } _%>
|
|
86
81
|
<%_ if (!authenticationTypeOauth2) { _%>
|
|
87
82
|
import org.springframework.security.authentication.ReactiveAuthenticationManager;
|
|
@@ -308,9 +303,7 @@ public class SecurityConfiguration {
|
|
|
308
303
|
.oauth2Login(oauth2 -> oauth2.authorizationRequestResolver(authorizationRequestResolver(this.clientRegistrationRepository)))
|
|
309
304
|
<%_ } _%>
|
|
310
305
|
.oauth2Client(withDefaults())
|
|
311
|
-
.oauth2ResourceServer(oauth2 -> oauth2
|
|
312
|
-
.jwt(jwt -> jwt
|
|
313
|
-
.jwtAuthenticationConverter(jwtAuthenticationConverter())));
|
|
306
|
+
.oauth2ResourceServer(oauth2 -> oauth2.jwt(withDefaults()));
|
|
314
307
|
<%_ } else if (authenticationTypeJwt) { _%>
|
|
315
308
|
.httpBasic(basic -> basic.disable())
|
|
316
309
|
.oauth2ResourceServer(oauth2 -> oauth2.jwt(withDefaults()));
|
|
@@ -338,13 +331,6 @@ public class SecurityConfiguration {
|
|
|
338
331
|
}
|
|
339
332
|
<%_ } _%>
|
|
340
333
|
|
|
341
|
-
Converter<Jwt, Mono<AbstractAuthenticationToken>> jwtAuthenticationConverter() {
|
|
342
|
-
JwtAuthenticationConverter jwtAuthenticationConverter = new JwtAuthenticationConverter();
|
|
343
|
-
jwtAuthenticationConverter.setJwtGrantedAuthoritiesConverter(new JwtGrantedAuthorityConverter());
|
|
344
|
-
jwtAuthenticationConverter.setPrincipalClaimName(PREFERRED_USERNAME);
|
|
345
|
-
return new ReactiveJwtAuthenticationConverterAdapter(jwtAuthenticationConverter);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
334
|
/**
|
|
349
335
|
* Map authorities from "groups" or "roles" claim in ID Token.
|
|
350
336
|
*
|
|
@@ -35,11 +35,6 @@ import org.springframework.security.oauth2.jwt.<%= reactive ? 'Reactive' : '' %>
|
|
|
35
35
|
import org.springframework.security.oauth2.jwt.JwtEncoder;
|
|
36
36
|
import org.springframework.security.oauth2.jwt.Nimbus<%= reactive ? 'Reactive' : '' %>JwtDecoder;
|
|
37
37
|
import org.springframework.security.oauth2.jwt.NimbusJwtEncoder;
|
|
38
|
-
import org.springframework.security.oauth2.server.resource.authentication.<%= reactive ? 'Reactive' : '' %>JwtAuthenticationConverter;
|
|
39
|
-
import org.springframework.security.oauth2.server.resource.authentication.JwtGrantedAuthoritiesConverter;
|
|
40
|
-
<%_ if (reactive) { _%>
|
|
41
|
-
import org.springframework.security.oauth2.server.resource.authentication.ReactiveJwtGrantedAuthoritiesConverterAdapter;
|
|
42
|
-
<%_ } _%>
|
|
43
38
|
<%_ if (communicationSpringWebsocket) { %>
|
|
44
39
|
import org.springframework.security.oauth2.server.resource.web.BearerTokenResolver;
|
|
45
40
|
import org.springframework.security.oauth2.server.resource.web.DefaultBearerTokenResolver;
|
|
@@ -113,21 +108,6 @@ public class SecurityJwtConfiguration {
|
|
|
113
108
|
return new NimbusJwtEncoder(new ImmutableSecret<>(getSecretKey()));
|
|
114
109
|
}
|
|
115
110
|
|
|
116
|
-
@Bean
|
|
117
|
-
public <%= reactive ? 'Reactive' : '' %>JwtAuthenticationConverter jwtAuthenticationConverter() {
|
|
118
|
-
JwtGrantedAuthoritiesConverter grantedAuthoritiesConverter = new JwtGrantedAuthoritiesConverter();
|
|
119
|
-
grantedAuthoritiesConverter.setAuthorityPrefix("");
|
|
120
|
-
grantedAuthoritiesConverter.setAuthoritiesClaimName(AUTHORITIES_KEY);
|
|
121
|
-
|
|
122
|
-
<%= reactive ? 'Reactive' : '' %>JwtAuthenticationConverter jwtAuthenticationConverter = new <%= reactive ? 'Reactive' : '' %>JwtAuthenticationConverter();
|
|
123
|
-
<%_ if (reactive) { %>
|
|
124
|
-
jwtAuthenticationConverter.setJwtGrantedAuthoritiesConverter(new ReactiveJwtGrantedAuthoritiesConverterAdapter(grantedAuthoritiesConverter));
|
|
125
|
-
<%_ } else { _%>
|
|
126
|
-
jwtAuthenticationConverter.setJwtGrantedAuthoritiesConverter(grantedAuthoritiesConverter);
|
|
127
|
-
<%_ } _%>
|
|
128
|
-
return jwtAuthenticationConverter;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
111
|
<%_ if (communicationSpringWebsocket) { %>
|
|
132
112
|
@Bean
|
|
133
113
|
public BearerTokenResolver bearerTokenResolver() {
|
package/dist/generators/server/templates/src/main/java/_package_/security/SecurityUtils.java.ejs
CHANGED
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
limitations under the License.
|
|
18
18
|
-%>
|
|
19
19
|
package <%= packageName %>.security;
|
|
20
|
+
<%_ if (generateAuthenticationApi && (authenticationTypeOauth2 || authenticationTypeJwt)) { _%>
|
|
21
|
+
|
|
22
|
+
import <%= packageName %>.config.Constants;
|
|
23
|
+
<%_ } _%>
|
|
20
24
|
|
|
21
25
|
import org.springframework.security.core.Authentication;
|
|
22
26
|
import org.springframework.security.core.GrantedAuthority;
|
|
@@ -35,23 +39,32 @@ import org.springframework.security.oauth2.jwt.Jwt;
|
|
|
35
39
|
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
|
36
40
|
import org.springframework.security.oauth2.core.oidc.user.DefaultOidcUser;
|
|
37
41
|
import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationToken;
|
|
38
|
-
import java.util
|
|
39
|
-
import java.util.
|
|
42
|
+
import java.util.Arrays;
|
|
43
|
+
import java.util.ArrayList;
|
|
44
|
+
import java.util.List;
|
|
40
45
|
<%_ if (reactive) { _%>
|
|
41
46
|
import reactor.core.publisher.Mono;
|
|
42
47
|
<%_ } else { _%>
|
|
43
48
|
import java.util.stream.Stream;
|
|
44
49
|
<%_ } _%>
|
|
45
50
|
<%_ } else { _%>
|
|
51
|
+
import java.util.Arrays;
|
|
46
52
|
<%_ if (reactive) { _%>
|
|
47
53
|
import reactor.core.publisher.Mono;
|
|
48
|
-
import java.util.Arrays;
|
|
49
54
|
<%_ } else { _%>
|
|
50
|
-
import java.util.Arrays;
|
|
51
|
-
import java.util.Optional;
|
|
52
55
|
import java.util.stream.Stream;
|
|
53
56
|
<%_ } _%>
|
|
54
57
|
<%_ } _%>
|
|
58
|
+
<%_ if (authenticationTypeOauth2 || authenticationTypeJwt || !reactive) { _%>
|
|
59
|
+
import java.util.Optional;
|
|
60
|
+
<%_ } _%>
|
|
61
|
+
<%_ if (authenticationTypeOauth2 || authenticationTypeJwt) { _%>
|
|
62
|
+
import org.springframework.security.oauth2.core.oidc.StandardClaimNames;
|
|
63
|
+
import java.util.Collection;
|
|
64
|
+
import java.util.HashMap;
|
|
65
|
+
import java.util.Map;
|
|
66
|
+
import java.util.stream.Collectors;
|
|
67
|
+
<%_ } _%>
|
|
55
68
|
|
|
56
69
|
/**
|
|
57
70
|
* Utility class for Spring Security.
|
|
@@ -230,4 +243,51 @@ public final class SecurityUtils {
|
|
|
230
243
|
.collect(Collectors.toList());
|
|
231
244
|
}
|
|
232
245
|
<%_ } _%>
|
|
246
|
+
<%_ if (generateAuthenticationApi && ((authenticationTypeOauth2 && !syncUserWithIdp) || (authenticationTypeJwt && skipUserManagement))) { _%>
|
|
247
|
+
|
|
248
|
+
public static Map<String, Object> extractDetailsFromTokenAttributes(Map<String, Object> attributes) {
|
|
249
|
+
Map<String, Object> details = new HashMap<>();
|
|
250
|
+
|
|
251
|
+
details.put("activated", Optional.ofNullable(attributes.get(StandardClaimNames.EMAIL_VERIFIED)).orElse(true));
|
|
252
|
+
Optional.ofNullable(attributes.get("uid")).ifPresent(id -> details.put("id", id));
|
|
253
|
+
Optional.ofNullable(attributes.get(StandardClaimNames.FAMILY_NAME)).ifPresent(lastName -> details.put("lastName", lastName));
|
|
254
|
+
Optional.ofNullable(attributes.get(StandardClaimNames.PICTURE)).ifPresent(imageUrl -> details.put("imageUrl", imageUrl));
|
|
255
|
+
|
|
256
|
+
Optional.ofNullable(attributes.get(StandardClaimNames.GIVEN_NAME)).ifPresentOrElse(
|
|
257
|
+
firstName -> details.put("firstName", firstName),
|
|
258
|
+
() -> Optional.ofNullable(attributes.get(StandardClaimNames.NAME)).ifPresent(firstName -> details.put("firstName", firstName))
|
|
259
|
+
);
|
|
260
|
+
|
|
261
|
+
if (attributes.get(StandardClaimNames.EMAIL) != null) {
|
|
262
|
+
details.put("email", attributes.get(StandardClaimNames.EMAIL));
|
|
263
|
+
} else {
|
|
264
|
+
String sub = String.valueOf(attributes.get(StandardClaimNames.SUB));
|
|
265
|
+
String preferredUsername = (String) attributes.get(StandardClaimNames.PREFERRED_USERNAME);
|
|
266
|
+
if (sub.contains("|") && (preferredUsername != null && preferredUsername.contains("@"))) {
|
|
267
|
+
// special handling for Auth0
|
|
268
|
+
details.put("email", preferredUsername);
|
|
269
|
+
} else {
|
|
270
|
+
details.put("email", sub);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if (attributes.get("langKey") != null) {
|
|
275
|
+
details.put("langKey", attributes.get("langKey"));
|
|
276
|
+
} else if (attributes.get(StandardClaimNames.LOCALE) != null) {
|
|
277
|
+
// trim off country code if it exists
|
|
278
|
+
String locale = (String) attributes.get(StandardClaimNames.LOCALE);
|
|
279
|
+
if (locale.contains("_")) {
|
|
280
|
+
locale = locale.substring(0, locale.indexOf('_'));
|
|
281
|
+
} else if (locale.contains("-")) {
|
|
282
|
+
locale = locale.substring(0, locale.indexOf('-'));
|
|
283
|
+
}
|
|
284
|
+
details.put("langKey", locale.toLowerCase());
|
|
285
|
+
} else {
|
|
286
|
+
// set langKey to default if not specified by IdP
|
|
287
|
+
details.put("langKey", Constants.DEFAULT_LANGUAGE);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
return details;
|
|
291
|
+
}
|
|
292
|
+
<%_ } _%>
|
|
233
293
|
}
|
package/dist/generators/server/templates/src/main/java/_package_/service/dto/UserDTO.java.ejs
CHANGED
|
@@ -23,6 +23,7 @@ import <%= user.entityAbsoluteClass %>;
|
|
|
23
23
|
<%_ } _%>
|
|
24
24
|
|
|
25
25
|
import java.io.Serializable;
|
|
26
|
+
import java.util.Objects;
|
|
26
27
|
<%_ if (user.primaryKey.hasUUID) { _%>
|
|
27
28
|
import java.util.UUID;
|
|
28
29
|
<%_ } _%>
|
|
@@ -76,10 +77,32 @@ public class <%= user.dtoClass %> implements Serializable {
|
|
|
76
77
|
public String get<%= field.propertyJavaBeanName %>() {
|
|
77
78
|
return <%= field.fieldName %>;
|
|
78
79
|
}
|
|
80
|
+
|
|
79
81
|
public void set<%= field.propertyJavaBeanName %>(String <%= field.fieldName %>) {
|
|
80
82
|
this.<%= field.fieldName %> = <%= field.fieldName %>;
|
|
81
83
|
}
|
|
84
|
+
|
|
85
|
+
<%_ } _%>
|
|
86
|
+
@Override
|
|
87
|
+
public boolean equals(Object o) {
|
|
88
|
+
if (this == o) {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
if (o == null || getClass() != o.getClass()) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
<%= user.dtoClass %> userDTO = (<%= user.dtoClass %>) o;
|
|
96
|
+
if (userDTO.getId() == null || getId() == null) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return Objects.equals(getId(), userDTO.getId()) &&
|
|
101
|
+
<%_ for (field of user.fields.filter(field => !field.builtIn && field.relatedByOtherEntity)) { _%>
|
|
102
|
+
Objects.equals(get<%= field.propertyJavaBeanName %>(), userDTO.get<%= field.propertyJavaBeanName %>()) &&
|
|
82
103
|
<%_ } _%>
|
|
104
|
+
Objects.equals(getLogin(), userDTO.getLogin());
|
|
105
|
+
}
|
|
83
106
|
|
|
84
107
|
// prettier-ignore
|
|
85
108
|
@Override
|
package/dist/generators/server/templates/src/main/java/_package_/service/mapper/UserMapper.java.ejs
CHANGED
|
@@ -84,14 +84,19 @@ public class UserMapper {
|
|
|
84
84
|
user.setEmail(userDTO.getEmail());
|
|
85
85
|
<%_ if (!databaseTypeCassandra) { _%>
|
|
86
86
|
user.setImageUrl(userDTO.getImageUrl());
|
|
87
|
+
<%_ } _%>
|
|
88
|
+
<%_ if (generateSpringAuditor) { _%>
|
|
89
|
+
user.setCreatedBy(userDTO.getCreatedBy());
|
|
90
|
+
user.setCreatedDate(userDTO.getCreatedDate());
|
|
91
|
+
user.setLastModifiedBy(userDTO.getLastModifiedBy());
|
|
92
|
+
user.setLastModifiedDate(userDTO.getLastModifiedDate());
|
|
87
93
|
<%_ } _%>
|
|
88
94
|
user.setActivated(userDTO.isActivated());
|
|
89
95
|
user.setLangKey(userDTO.getLangKey());
|
|
90
96
|
<%_ if (databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j) { _%>
|
|
91
97
|
Set<Authority> authorities = this.authoritiesFromStrings(userDTO.getAuthorities());
|
|
92
98
|
user.setAuthorities(authorities);
|
|
93
|
-
<%_ } _%>
|
|
94
|
-
<%_ if (databaseTypeCassandra || databaseTypeCouchbase) { _%>
|
|
99
|
+
<%_ } else { _%>
|
|
95
100
|
Set<String> authorities = this.cleanNullStringAuthorities(userDTO.getAuthorities());
|
|
96
101
|
user.setAuthorities(authorities);
|
|
97
102
|
<%_ } _%>
|
|
@@ -114,8 +119,7 @@ public class UserMapper {
|
|
|
114
119
|
|
|
115
120
|
return authorities;
|
|
116
121
|
}
|
|
117
|
-
<%_ } _%>
|
|
118
|
-
<%_ if (databaseTypeCassandra || databaseTypeCouchbase) { _%>
|
|
122
|
+
<%_ } else { _%>
|
|
119
123
|
|
|
120
124
|
private Set<String> cleanNullStringAuthorities(Set<String> authoritiesAsString) {
|
|
121
125
|
Set<String> authorities = new HashSet<>();
|
|
@@ -18,6 +18,11 @@
|
|
|
18
18
|
-%>
|
|
19
19
|
package <%= packageName %>.web.rest;
|
|
20
20
|
|
|
21
|
+
import <%= packageName %>.security.SecurityUtils;
|
|
22
|
+
<%_ if (generateBuiltInAuthorityEntity) { _%>
|
|
23
|
+
import <%= packageName %>.domain.Authority;
|
|
24
|
+
|
|
25
|
+
<%_ } _%>
|
|
21
26
|
<%_ if (reactive) { _%>
|
|
22
27
|
import reactor.core.publisher.Mono;
|
|
23
28
|
<%_ } else { _%>
|
|
@@ -47,7 +52,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
|
|
|
47
52
|
<%_ } _%>
|
|
48
53
|
<%_ } _%>
|
|
49
54
|
|
|
50
|
-
import com.fasterxml.jackson.annotation.
|
|
55
|
+
import com.fasterxml.jackson.annotation.JsonAnyGetter;
|
|
51
56
|
import org.slf4j.Logger;
|
|
52
57
|
import org.slf4j.LoggerFactory;
|
|
53
58
|
import org.springframework.security.core.GrantedAuthority;
|
|
@@ -55,6 +60,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|
|
55
60
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
56
61
|
import org.springframework.web.bind.annotation.RestController;
|
|
57
62
|
|
|
63
|
+
import java.util.Map;
|
|
58
64
|
import java.util.Set;
|
|
59
65
|
import java.util.stream.Collectors;
|
|
60
66
|
|
|
@@ -157,12 +163,21 @@ public class AccountResource {
|
|
|
157
163
|
|
|
158
164
|
private static class UserVM {
|
|
159
165
|
private String login;
|
|
166
|
+
<%_ if (generateBuiltInAuthorityEntity) { _%>
|
|
167
|
+
private Set<Authority> authorities;
|
|
168
|
+
<%_ } else { _%>
|
|
160
169
|
private Set<String> authorities;
|
|
170
|
+
<%_ } _%>
|
|
171
|
+
<%_ if (authenticationTypeOauth2 || authenticationTypeJwt) { _%>
|
|
172
|
+
private Map<String, Object> details;
|
|
173
|
+
<%_ } _%>
|
|
161
174
|
|
|
162
|
-
|
|
163
|
-
UserVM(String login, Set<String> authorities) {
|
|
175
|
+
UserVM(String login, Set<String> authorities<% if (authenticationTypeOauth2 || authenticationTypeJwt) { %>, Map<String, Object> details<% } %>) {
|
|
164
176
|
this.login = login;
|
|
165
177
|
this.authorities = authorities;
|
|
178
|
+
<%_ if (authenticationTypeOauth2 || authenticationTypeJwt) { _%>
|
|
179
|
+
this.details = details;
|
|
180
|
+
<%_ } _%>
|
|
166
181
|
}
|
|
167
182
|
|
|
168
183
|
public boolean isActivated() {
|
|
@@ -176,22 +191,41 @@ public class AccountResource {
|
|
|
176
191
|
public String getLogin() {
|
|
177
192
|
return login;
|
|
178
193
|
}
|
|
194
|
+
<%_ if (authenticationTypeOauth2 || authenticationTypeJwt) { _%>
|
|
195
|
+
|
|
196
|
+
@JsonAnyGetter
|
|
197
|
+
public Map<String, Object> getDetails() {
|
|
198
|
+
return details;
|
|
199
|
+
}
|
|
200
|
+
<%_ } _%>
|
|
179
201
|
}
|
|
180
202
|
<%_ if (authenticationTypeOauth2 || authenticationTypeJwt) { _%>
|
|
181
203
|
|
|
182
|
-
private UserVM getUserFromAuthentication(AbstractAuthenticationToken authToken) {
|
|
183
|
-
|
|
204
|
+
private static UserVM getUserFromAuthentication(AbstractAuthenticationToken authToken) {
|
|
205
|
+
Map<String, Object> attributes;
|
|
206
|
+
if (authToken instanceof JwtAuthenticationToken) {
|
|
207
|
+
attributes = ((JwtAuthenticationToken) authToken).getTokenAttributes();
|
|
184
208
|
<%_ if (authenticationTypeOauth2) { _%>
|
|
185
|
-
|
|
209
|
+
} else if (authToken instanceof OAuth2AuthenticationToken) {
|
|
210
|
+
attributes = ((OAuth2AuthenticationToken) authToken).getPrincipal().getAttributes();
|
|
186
211
|
<%_ } _%>
|
|
187
|
-
|
|
188
|
-
) {
|
|
212
|
+
} else {
|
|
189
213
|
throw new IllegalArgumentException("AuthenticationToken is not OAuth2 or JWT!");
|
|
190
214
|
}
|
|
191
215
|
|
|
192
216
|
return new UserVM(
|
|
193
217
|
authToken.getName(),
|
|
194
|
-
authToken.getAuthorities().stream()
|
|
218
|
+
authToken.getAuthorities().stream()
|
|
219
|
+
.map(GrantedAuthority::getAuthority)
|
|
220
|
+
<%_ if (generateBuiltInAuthorityEntity) { _%>
|
|
221
|
+
.map(authority -> {
|
|
222
|
+
Authority auth = new Authority();
|
|
223
|
+
auth.setName(authority);
|
|
224
|
+
return auth;
|
|
225
|
+
})
|
|
226
|
+
<%_ } _%>
|
|
227
|
+
.collect(Collectors.toSet()),
|
|
228
|
+
SecurityUtils.extractDetailsFromTokenAttributes(attributes)
|
|
195
229
|
);
|
|
196
230
|
}
|
|
197
231
|
<%_ } _%>
|