generator-jhipster 7.9.2 → 7.9.3
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/cli/environment-builder.js +15 -1
- package/generators/app/index.js +12 -1
- package/generators/bootstrap/index.js +33 -1
- package/generators/ci-cd/templates/circle.yml.ejs +3 -13
- package/generators/client/files-angular.js +1 -1
- package/generators/client/files-react.js +5 -2
- package/generators/client/files-vue.js +3 -2
- package/generators/client/templates/angular/jest.conf.js.ejs +6 -3
- package/generators/client/templates/angular/package.json +18 -18
- package/generators/client/templates/angular/package.json.ejs +3 -7
- package/generators/client/templates/angular/src/main/webapp/app/admin/admin-routing.module.ts.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/admin/health/health.model.ts.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/admin/user-management/update/user-management-update.component.ts.ejs +17 -15
- package/generators/client/templates/angular/src/main/webapp/app/admin/user-management/user-management.model.ts.ejs +2 -2
- package/generators/client/templates/angular/src/main/webapp/app/admin/user-management/user-management.route.ts.ejs +4 -4
- package/generators/client/templates/angular/src/main/webapp/app/core/request/request-util.ts.ejs +4 -2
- package/generators/client/templates/angular/src/main/webapp/app/core/util/data-util.service.ts.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/core/util/parse-links.service.ts.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/layouts/navbar/navbar.component.html.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/shared/filter/filter.component.html.ejs +8 -6
- package/generators/client/templates/angular/src/main/webapp/app/shared/filter/filter.component.ts.ejs +6 -11
- package/generators/client/templates/angular/src/main/webapp/app/shared/filter/filter.model.spec.ts.ejs +227 -25
- package/generators/client/templates/angular/src/main/webapp/app/shared/filter/filter.model.ts.ejs +104 -43
- package/generators/client/templates/angular/src/main/webapp/content/scss/global.scss.ejs +8 -0
- package/generators/client/templates/angular/tsconfig.json.ejs +0 -1
- package/generators/client/templates/angular/tsconfig.spec.json.ejs +2 -3
- package/generators/client/templates/angular/webpack/webpack.microfrontend.js.ejs +0 -3
- package/generators/client/templates/common/package.json +4 -4
- package/generators/client/templates/common/src/main/webapp/swagger-ui/index.html.ejs +1 -1
- package/generators/client/templates/react/jest.conf.js.ejs +2 -2
- package/generators/client/templates/react/package.json +23 -23
- package/generators/client/templates/react/package.json.ejs +3 -7
- package/generators/client/templates/react/src/main/webapp/app/config/store.ts.ejs +0 -6
- package/generators/client/templates/react/src/main/webapp/app/modules/administration/administration.reducer.spec.ts.ejs +7 -7
- package/generators/client/templates/react/src/main/webapp/app/modules/administration/administration.reducer.ts.ejs +6 -6
- package/generators/client/templates/react/src/main/webapp/app/modules/administration/index.tsx.ejs +2 -2
- package/generators/client/templates/react/src/main/webapp/app/shared/layout/menus/admin.tsx.ejs +1 -1
- package/generators/client/templates/react/src/main/webapp/app/shared/reducers/authentication.spec.ts.ejs +17 -8
- package/generators/client/templates/react/src/main/webapp/app/shared/reducers/authentication.ts.ejs +1 -1
- package/generators/client/templates/react/src/main/webapp/app/shared/reducers/locale.spec.ts.ejs +176 -19
- package/generators/client/templates/react/src/main/webapp/app/shared/reducers/locale.ts.ejs +46 -13
- package/generators/client/templates/react/webpack/webpack.microfrontend.js.jhi.react.ejs +1 -1
- package/generators/client/templates/vue/package.json +17 -17
- package/generators/client/templates/vue/package.json.ejs +3 -7
- package/generators/client/templates/vue/src/main/webapp/app/core/jhi-navbar/jhi-navbar.component.ts.ejs +2 -1
- package/generators/client/templates/vue/src/main/webapp/app/core/jhi-navbar/jhi-navbar.vue.ejs +1 -1
- package/generators/client/templates/vue/src/main/webapp/app/main.ts.ejs +2 -2
- package/generators/client/templates/vue/src/main/webapp/app/router/admin.ts.ejs +2 -2
- package/generators/client/templates/vue/src/test/javascript/e2e/modules/administration/administration.spec.ts.ejs +1 -1
- package/generators/client/templates/vue/src/test/javascript/e2e/page-objects/administration-page.ts.ejs +1 -1
- package/generators/client/templates/vue/src/test/javascript/e2e/page-objects/navbar-page.ts.ejs +2 -2
- package/generators/client/templates/vue/src/test/javascript/jest.conf.js.ejs +5 -6
- package/generators/client/templates/vue/src/test/javascript/spec/app/account/account.service.spec.ts.ejs +4 -0
- package/generators/client/templates/vue/src/test/javascript/spec/app/shared/alert/alert.service.spec.ts.ejs +106 -3
- package/generators/client/templates/vue/src/test/javascript/spec/app/shared/config/axios-interceptor.spec.ts.ejs +12 -0
- package/generators/client/templates/vue/src/test/javascript/spec/app/shared/config/formatter.spec.ts.ejs +6 -0
- package/generators/client/templates/vue/src/test/javascript/spec/app/shared/sort/sorts.spec.ts.ejs +10 -0
- package/generators/client/templates/vue/webpack/webpack.common.js.ejs +1 -1
- package/generators/client/templates/vue/webpack/webpack.dev.js.ejs +2 -2
- package/generators/common/files.js +5 -4
- package/generators/common/templates/package.json +1 -1
- package/generators/common/templates/sonar-project.properties.ejs +19 -11
- package/generators/cypress/index.js +1 -1
- package/generators/docker-compose/templates/README-DOCKER-COMPOSE.md.ejs +3 -3
- package/generators/docker-compose/templates/docker-compose.yml.ejs +1 -1
- package/generators/docker-compose/templates/realm-config/jhipster-realm.json.ejs +32 -14
- package/generators/entity/index.js +4 -3
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/detail/entity-management-detail.component.html.ejs +1 -1
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/list/entity-management.component.html.ejs +18 -6
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/list/entity-management.component.spec.ts.ejs +1 -1
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/list/entity-management.component.ts.ejs +23 -19
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/service/entity.service.spec.ts.ejs +3 -1
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/service/entity.service.ts.ejs +1 -1
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/update/entity-form.service.ts.ejs +1 -1
- package/generators/entity-client/templates/vue/src/main/webapp/app/entities/entity.component.ts.ejs +2 -2
- package/generators/entity-server/templates/src/main/java/package/common/delete_template.ejs +7 -3
- package/generators/entity-server/templates/src/main/java/package/common/get_all_template.ejs +2 -2
- package/generators/entity-server/templates/src/main/java/package/domain/Entity.java.jhi.ejs +15 -5
- package/generators/entity-server/templates/src/main/java/package/domain/Entity.java.jhi.spring_data_persistable.ejs +8 -1
- package/generators/entity-server/templates/src/main/java/package/repository/EntityRepositoryInternalImpl_reactive.java.ejs +5 -0
- package/generators/entity-server/templates/src/main/java/package/service/EntityQueryService.java.ejs +4 -4
- package/generators/entity-server/templates/src/main/java/package/service/EntityService.java.ejs +6 -4
- package/generators/entity-server/templates/src/main/java/package/service/criteria/EntityCriteria.java.ejs +3 -26
- package/generators/entity-server/templates/src/main/java/package/service/dto/EntityDTO.java.ejs +1 -0
- package/generators/entity-server/templates/src/main/java/package/service/impl/EntityServiceImpl.java.ejs +1 -1
- package/generators/entity-server/templates/src/test/java/package/web/rest/EntityResourceIT.java.ejs +33 -28
- package/generators/generate-blueprint/constants.mjs +46 -6
- package/generators/generate-blueprint/files.mjs +7 -5
- package/generators/generate-blueprint/generator.mjs +73 -19
- package/generators/generate-blueprint/templates/generators/generator/generator.spec.mjs.ejs +1 -1
- package/generators/generator-base-blueprint.js +23 -1
- package/generators/generator-base-entities.cjs +5 -1
- package/generators/generator-base.js +82 -15
- package/generators/generator-constants.js +17 -23
- package/generators/kubernetes/templates/deployment.yml.ejs +1 -1
- package/generators/kubernetes/templates/ingress.yml.ejs +1 -1
- package/generators/kubernetes/templates/istio/gateway.yml.ejs +1 -1
- package/generators/kubernetes/templates/kustomize/kustomization.yml.ejs +1 -1
- package/generators/kubernetes/templates/service.yml.ejs +1 -1
- package/generators/kubernetes-knative/templates/istio/gateway.yml.ejs +1 -1
- package/generators/kubernetes-knative/templates/service.yml.ejs +3 -3
- package/generators/languages/templates/src/main/webapp/i18n/al/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/ar-ly/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/bg/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/bn/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/by/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/ca/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/cs/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/da/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/de/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/el/activate.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/el/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/el/password.json +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/el/register.json +3 -3
- package/generators/languages/templates/src/main/webapp/i18n/el/tracker.json +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/el/user-management.json +9 -9
- package/generators/languages/templates/src/main/webapp/i18n/en/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/es/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/et/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/fa/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/fi/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/fr/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/gl/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/hi/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/hr/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/hu/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/hy/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/in/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/it/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/ja/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/ko/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/mr/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/my/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/nl/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/pa/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/pl/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/pt-br/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/pt-pt/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/ro/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/ru/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/si/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/sk/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/sr/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/sv/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/ta/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/te/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/th/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/tr/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/ua/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/uz-Latn-uz/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/vi/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/zh-cn/health.json.ejs +1 -1
- package/generators/languages/templates/src/main/webapp/i18n/zh-tw/health.json.ejs +1 -1
- package/generators/openshift/templates/deployment.yml.ejs +2 -2
- package/generators/server/cleanup-elasticsearch.js +5 -0
- package/generators/server/files.js +17 -8
- package/generators/server/index.js +0 -2
- package/generators/server/templates/build.gradle.ejs +6 -14
- package/generators/server/templates/gradle/profile_dev.gradle.ejs +1 -1
- package/generators/server/templates/gradle/profile_prod.gradle.ejs +1 -1
- package/generators/server/templates/gradle.properties.ejs +6 -4
- package/generators/server/templates/npmw.cmd +31 -29
- package/generators/server/templates/package.json.ejs +2 -2
- package/generators/server/templates/pom.xml.ejs +12 -23
- package/generators/server/templates/sql/common/src/test/java/package/config/MsSqlTestContainer.java.ejs +2 -3
- package/generators/server/templates/src/main/docker/app.yml.ejs +7 -1
- package/generators/server/templates/src/main/docker/config/realm-config/jhipster-realm.json.ejs +32 -14
- package/generators/server/templates/src/main/docker/jhipster-control-center.yml.ejs +1 -1
- package/generators/server/templates/src/main/docker/prometheus/prometheus.yml.ejs +1 -1
- package/generators/server/templates/src/main/java/package/Application.java.ejs +11 -4
- package/generators/server/templates/src/main/java/package/config/CRLFLogConverter.java.ejs +57 -0
- package/generators/server/templates/src/main/java/package/config/EurekaWorkaroundConfiguration.java.ejs +49 -0
- package/generators/server/templates/src/main/java/package/config/LoggingConfiguration.java.ejs +4 -4
- package/generators/server/templates/src/main/java/package/config/SecurityConfiguration.java.ejs +17 -18
- package/generators/server/templates/src/main/java/package/config/SecurityConfiguration_reactive.java.ejs +13 -5
- package/generators/server/templates/src/main/java/package/domain/AbstractAuditingEntity.java.ejs +5 -6
- package/generators/server/templates/src/main/java/package/domain/User.java.ejs +1 -1
- package/generators/server/templates/src/main/java/package/repository/UserRepository.java.ejs +1 -1
- package/generators/server/templates/src/main/java/package/security/oauth2/CustomClaimConverter.java.ejs +13 -6
- package/generators/server/templates/src/main/java/package/service/dto/AdminUserDTO.java.ejs +3 -1
- package/generators/server/templates/src/main/java/package/service/dto/PasswordChangeDTO.java.ejs +5 -1
- package/generators/server/templates/src/main/java/package/service/dto/UserDTO.java.ejs +3 -1
- package/generators/server/templates/src/main/java/package/web/rest/UserResource.java.ejs +15 -42
- package/generators/server/templates/src/main/java/package/web/rest/errors/BadRequestAlertException.java.ejs +1 -0
- package/generators/server/templates/src/main/java/package/web/rest/errors/EmailAlreadyUsedException.java.ejs +1 -0
- package/generators/server/templates/src/main/java/package/web/rest/errors/InvalidPasswordException.java.ejs +1 -0
- package/generators/server/templates/src/main/java/package/web/rest/errors/LoginAlreadyUsedException.java.ejs +1 -0
- package/generators/server/templates/src/main/resources/config/application-dev.yml.ejs +1 -1
- package/generators/server/templates/src/main/resources/config/application-prod.yml.ejs +2 -2
- package/generators/server/templates/src/main/resources/config/application.yml.ejs +4 -2
- package/generators/server/templates/src/main/resources/config/liquibase/master.xml.ejs +3 -8
- package/generators/server/templates/src/main/resources/logback-spring.xml.ejs +5 -0
- package/generators/server/templates/src/test/java/package/config/{ElasticsearchReactiveTestConfiguration.java.ejs → ElasticsearchTestConfiguration.java.ejs} +3 -3
- package/generators/server/templates/src/test/java/package/config/ElasticsearchTestContainer.java.ejs +1 -0
- package/generators/server/templates/src/test/java/package/config/JHipsterBlockHoundIntegration.java.ejs +3 -0
- package/generators/server/templates/src/test/java/package/config/TestContainersSpringContextCustomizerFactory.java.ejs +2 -2
- package/generators/sql-constants.js +5 -2
- package/generators/utils.js +43 -3
- package/generators/workspaces/index.js +2 -1
- package/jdl/exporters/jdl-exporter.js +6 -1
- package/jdl/jhipster/application-options.js +2 -1
- package/jdl/jhipster/binary-options.js +2 -2
- package/jdl/jhipster/default-application-options.js +11 -8
- package/jdl/jhipster/entity-options.js +1 -0
- package/jdl/jhipster/search-engine-types.js +1 -0
- package/lib/constants/priorities.cjs +16 -0
- package/lib/constants/priorities.mjs +1 -0
- package/lib/index.js +2 -0
- package/lib/support/base.cjs +2 -1
- package/package.json +7 -6
- package/utils/blueprint.js +10 -0
- package/utils/field.js +3 -1
- package/generators/client/templates/react/src/main/webapp/app/config/translation-middleware.ts.ejs +0 -58
- package/generators/server/templates/.npmrc.ejs +0 -1
|
@@ -134,6 +134,10 @@ import reactor.core.publisher.Mono;
|
|
|
134
134
|
<%_ if (!applicationTypeMicroservice) { _%>
|
|
135
135
|
import org.springframework.web.reactive.function.client.WebClient;
|
|
136
136
|
|
|
137
|
+
import com.github.benmanes.caffeine.cache.Cache;
|
|
138
|
+
import com.github.benmanes.caffeine.cache.Caffeine;
|
|
139
|
+
|
|
140
|
+
import java.time.Duration;
|
|
137
141
|
import java.util.Arrays;
|
|
138
142
|
import java.util.Map;
|
|
139
143
|
<%_ } _%>
|
|
@@ -141,7 +145,6 @@ import java.util.Map;
|
|
|
141
145
|
import java.util.HashSet;
|
|
142
146
|
import java.util.Set;
|
|
143
147
|
<%_ if (!applicationTypeMicroservice) { _%>
|
|
144
|
-
import java.util.concurrent.ConcurrentHashMap;
|
|
145
148
|
import java.util.function.Consumer;
|
|
146
149
|
<%_ } _%>
|
|
147
150
|
<%_ } _%>
|
|
@@ -170,8 +173,13 @@ public class SecurityConfiguration {
|
|
|
170
173
|
|
|
171
174
|
private final ReactiveClientRegistrationRepository clientRegistrationRepository;
|
|
172
175
|
|
|
173
|
-
//
|
|
174
|
-
|
|
176
|
+
// See https://github.com/jhipster/generator-jhipster/issues/18868
|
|
177
|
+
// We don't use a distributed cache or the user selected cache implementation here on purpose
|
|
178
|
+
private final Cache<String, Mono<Jwt>> users = Caffeine.newBuilder()
|
|
179
|
+
.maximumSize(10_000)
|
|
180
|
+
.expireAfterWrite(Duration.ofHours(1))
|
|
181
|
+
.recordStats()
|
|
182
|
+
.build();
|
|
175
183
|
|
|
176
184
|
<%_ } _%>
|
|
177
185
|
<%_ } _%>
|
|
@@ -268,7 +276,7 @@ public class SecurityConfiguration {
|
|
|
268
276
|
<%_ } _%>
|
|
269
277
|
.and()
|
|
270
278
|
.headers()
|
|
271
|
-
|
|
279
|
+
.contentSecurityPolicy(jHipsterProperties.getSecurity().getContentSecurityPolicy())
|
|
272
280
|
.and()
|
|
273
281
|
.referrerPolicy(ReferrerPolicyServerHttpHeadersWriter.ReferrerPolicy.STRICT_ORIGIN_WHEN_CROSS_ORIGIN)
|
|
274
282
|
.and()
|
|
@@ -425,7 +433,7 @@ public class SecurityConfiguration {
|
|
|
425
433
|
return Mono.just(jwt);
|
|
426
434
|
}
|
|
427
435
|
// Retrieve user info from OAuth provider if not already loaded
|
|
428
|
-
return users.
|
|
436
|
+
return users.get(jwt.getSubject(), s -> {
|
|
429
437
|
WebClient webClient = WebClient.create();
|
|
430
438
|
|
|
431
439
|
return webClient
|
package/generators/server/templates/src/main/java/package/domain/AbstractAuditingEntity.java.ejs
CHANGED
|
@@ -21,7 +21,7 @@ package <%= packageName %>.domain;
|
|
|
21
21
|
<%_ if (databaseTypeCouchbase) { _%>
|
|
22
22
|
import org.springframework.data.couchbase.core.mapping.Field;
|
|
23
23
|
<%_ } _%>
|
|
24
|
-
import com.fasterxml.jackson.annotation.
|
|
24
|
+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
25
25
|
<%_ if (!reactive) { _%>
|
|
26
26
|
import org.springframework.data.annotation.CreatedBy;
|
|
27
27
|
<%_ } _%>
|
|
@@ -58,10 +58,13 @@ import javax.persistence.MappedSuperclass;
|
|
|
58
58
|
@MappedSuperclass
|
|
59
59
|
@EntityListeners(AuditingEntityListener.class)
|
|
60
60
|
<%_ } _%>
|
|
61
|
-
|
|
61
|
+
@JsonIgnoreProperties(value = { "createdBy", "createdDate", "lastModifiedBy", "lastModifiedDate" }, allowGetters = true)
|
|
62
|
+
public abstract class AbstractAuditingEntity<T> implements Serializable {
|
|
62
63
|
|
|
63
64
|
private static final long serialVersionUID = 1L;
|
|
64
65
|
|
|
66
|
+
public abstract T getId();
|
|
67
|
+
|
|
65
68
|
<%_ if (!reactive) { _%>
|
|
66
69
|
@CreatedBy
|
|
67
70
|
<%_ } _%>
|
|
@@ -77,7 +80,6 @@ public abstract class AbstractAuditingEntity implements Serializable {
|
|
|
77
80
|
<%_ if (databaseTypeNeo4j) { _%>
|
|
78
81
|
@Property("created_by")
|
|
79
82
|
<%_ } _%>
|
|
80
|
-
@JsonIgnore
|
|
81
83
|
private String createdBy;
|
|
82
84
|
|
|
83
85
|
@CreatedDate
|
|
@@ -93,7 +95,6 @@ public abstract class AbstractAuditingEntity implements Serializable {
|
|
|
93
95
|
<%_ if (databaseTypeNeo4j) { _%>
|
|
94
96
|
@Property("created_date")
|
|
95
97
|
<%_ } _%>
|
|
96
|
-
@JsonIgnore
|
|
97
98
|
private Instant createdDate = Instant.now();
|
|
98
99
|
|
|
99
100
|
<%_ if (!reactive) { _%>
|
|
@@ -111,7 +112,6 @@ public abstract class AbstractAuditingEntity implements Serializable {
|
|
|
111
112
|
<%_ if (databaseTypeNeo4j) { _%>
|
|
112
113
|
@Property("last_modified_by")
|
|
113
114
|
<%_ } _%>
|
|
114
|
-
@JsonIgnore
|
|
115
115
|
private String lastModifiedBy;
|
|
116
116
|
|
|
117
117
|
@LastModifiedDate
|
|
@@ -127,7 +127,6 @@ public abstract class AbstractAuditingEntity implements Serializable {
|
|
|
127
127
|
<%_ if (databaseTypeNeo4j) { _%>
|
|
128
128
|
@Property("last_modified_date")
|
|
129
129
|
<%_ } _%>
|
|
130
|
-
@JsonIgnore
|
|
131
130
|
private Instant lastModifiedDate = Instant.now();
|
|
132
131
|
|
|
133
132
|
public String getCreatedBy() {
|
|
@@ -131,7 +131,7 @@ import static org.springframework.data.couchbase.core.mapping.id.GenerationStrat
|
|
|
131
131
|
<%_ if (searchEngineElasticsearch) { _%>
|
|
132
132
|
@org.springframework.data.elasticsearch.annotations.Document(indexName = "user")
|
|
133
133
|
<%_ } _%>
|
|
134
|
-
public class <%= asEntity('User') %><% if (databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j || databaseTypeCouchbase) { %> extends AbstractAuditingEntity
|
|
134
|
+
public class <%= asEntity('User') %><% if (databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j || databaseTypeCouchbase) { %> extends AbstractAuditingEntity<<%= user.primaryKey.type %>><% } %> implements Serializable {
|
|
135
135
|
|
|
136
136
|
private static final long serialVersionUID = 1L;
|
|
137
137
|
|
package/generators/server/templates/src/main/java/package/repository/UserRepository.java.ejs
CHANGED
|
@@ -315,7 +315,7 @@ public interface UserRepository extends R2dbcRepository<<%= asEntity('User') %>,
|
|
|
315
315
|
Mono<Void> deleteAllUserAuthorities();
|
|
316
316
|
|
|
317
317
|
@Query("DELETE FROM <%= jhiTablePrefix %>_user_authority WHERE user_id = :userId")
|
|
318
|
-
Mono<Void> deleteUserAuthorities(
|
|
318
|
+
Mono<Void> deleteUserAuthorities(<%= user.primaryKey.type %> userId);
|
|
319
319
|
|
|
320
320
|
}
|
|
321
321
|
|
|
@@ -20,6 +20,8 @@ package <%= packageName %>.security.oauth2;
|
|
|
20
20
|
|
|
21
21
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
22
22
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
23
|
+
import com.github.benmanes.caffeine.cache.Cache;
|
|
24
|
+
import com.github.benmanes.caffeine.cache.Caffeine;
|
|
23
25
|
import <%= packageName %>.security.SecurityUtils;
|
|
24
26
|
import org.springframework.core.convert.converter.Converter;
|
|
25
27
|
import org.springframework.http.HttpEntity;
|
|
@@ -35,11 +37,11 @@ import org.springframework.web.context.request.RequestAttributes;
|
|
|
35
37
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
36
38
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
37
39
|
|
|
40
|
+
import java.time.Duration;
|
|
38
41
|
import java.util.Arrays;
|
|
39
42
|
import java.util.Collections;
|
|
40
43
|
import java.util.List;
|
|
41
44
|
import java.util.Map;
|
|
42
|
-
import java.util.concurrent.ConcurrentHashMap;
|
|
43
45
|
import java.util.stream.Collectors;
|
|
44
46
|
import java.util.stream.StreamSupport;
|
|
45
47
|
|
|
@@ -55,8 +57,13 @@ public class CustomClaimConverter implements Converter<Map<String, Object>, Map<
|
|
|
55
57
|
|
|
56
58
|
private final ClientRegistration registration;
|
|
57
59
|
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
+
// See https://github.com/jhipster/generator-jhipster/issues/18868
|
|
61
|
+
// We don't use a distributed cache or the user selected cache implementation here on purpose
|
|
62
|
+
private final Cache<String, ObjectNode> users = Caffeine.newBuilder()
|
|
63
|
+
.maximumSize(10_000)
|
|
64
|
+
.expireAfterWrite(Duration.ofHours(1))
|
|
65
|
+
.recordStats()
|
|
66
|
+
.build();
|
|
60
67
|
|
|
61
68
|
public CustomClaimConverter(ClientRegistration registration, RestTemplate restTemplate) {
|
|
62
69
|
this.registration = registration;
|
|
@@ -64,11 +71,11 @@ public class CustomClaimConverter implements Converter<Map<String, Object>, Map<
|
|
|
64
71
|
}
|
|
65
72
|
|
|
66
73
|
public Map<String, Object> convert(Map<String, Object> claims) {
|
|
74
|
+
Map<String, Object> convertedClaims = this.delegate.convert(claims);
|
|
67
75
|
// Only look up user information if identity claims are missing
|
|
68
76
|
if (claims.containsKey("given_name") && claims.containsKey("family_name")) {
|
|
69
|
-
return
|
|
77
|
+
return convertedClaims;
|
|
70
78
|
}
|
|
71
|
-
Map<String, Object> convertedClaims = this.delegate.convert(claims);
|
|
72
79
|
RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
|
|
73
80
|
if (attributes instanceof ServletRequestAttributes) {
|
|
74
81
|
// Retrieve and set the token
|
|
@@ -77,7 +84,7 @@ public class CustomClaimConverter implements Converter<Map<String, Object>, Map<
|
|
|
77
84
|
headers.set("Authorization", buildBearer(token));
|
|
78
85
|
|
|
79
86
|
// Retrieve user info from OAuth provider if not already loaded
|
|
80
|
-
ObjectNode user = users.
|
|
87
|
+
ObjectNode user = users.get(claims.get("sub").toString(), s -> {
|
|
81
88
|
ResponseEntity<ObjectNode> userInfo = restTemplate.exchange(registration.getProviderDetails().getUserInfoEndpoint().getUri(), HttpMethod.GET, new HttpEntity<String>(headers), ObjectNode.class);
|
|
82
89
|
return userInfo.getBody();
|
|
83
90
|
});
|
|
@@ -25,6 +25,7 @@ import <%= packageName %>.domain.Authority;<% } %>
|
|
|
25
25
|
import <%= packageName %>.domain.<%= asEntity('User') %>;
|
|
26
26
|
<%_ } _%>
|
|
27
27
|
|
|
28
|
+
import java.io.Serializable;
|
|
28
29
|
import javax.validation.constraints.*;
|
|
29
30
|
<%_ if (databaseTypeMongodb || databaseTypeNeo4j || databaseTypeCouchbase || databaseTypeSql) { _%>
|
|
30
31
|
import java.time.Instant;
|
|
@@ -40,7 +41,8 @@ import java.util.stream.Collectors;
|
|
|
40
41
|
/**
|
|
41
42
|
* A DTO representing a user, with his authorities.
|
|
42
43
|
*/
|
|
43
|
-
public class <%= asDto('AdminUser') %> {
|
|
44
|
+
public class <%= asDto('AdminUser') %> implements Serializable {
|
|
45
|
+
private static final long serialVersionUID = 1L;
|
|
44
46
|
|
|
45
47
|
private <%= user.primaryKey.type %> id;
|
|
46
48
|
|
package/generators/server/templates/src/main/java/package/service/dto/PasswordChangeDTO.java.ejs
CHANGED
|
@@ -18,10 +18,14 @@
|
|
|
18
18
|
-%>
|
|
19
19
|
package <%= packageName %>.service.dto;
|
|
20
20
|
|
|
21
|
+
import java.io.Serializable;
|
|
22
|
+
|
|
21
23
|
/**
|
|
22
24
|
* A DTO representing a password change required data - current and new password.
|
|
23
25
|
*/
|
|
24
|
-
public class PasswordChangeDTO {
|
|
26
|
+
public class PasswordChangeDTO implements Serializable {
|
|
27
|
+
private static final long serialVersionUID = 1L;
|
|
28
|
+
|
|
25
29
|
private String currentPassword;
|
|
26
30
|
private String newPassword;
|
|
27
31
|
|
|
@@ -22,6 +22,7 @@ package <%= packageName %>.service.dto;
|
|
|
22
22
|
import <%= packageName %>.domain.<%= asEntity('User') %>;
|
|
23
23
|
<%_ } _%>
|
|
24
24
|
|
|
25
|
+
import java.io.Serializable;
|
|
25
26
|
<%_ if (user.primaryKey.hasUUID) { _%>
|
|
26
27
|
import java.util.UUID;
|
|
27
28
|
<%_ } _%>
|
|
@@ -29,7 +30,8 @@ import java.util.UUID;
|
|
|
29
30
|
/**
|
|
30
31
|
* A DTO representing a user, with only the public attributes.
|
|
31
32
|
*/
|
|
32
|
-
public class <%= asDto('User') %> {
|
|
33
|
+
public class <%= asDto('User') %> implements Serializable {
|
|
34
|
+
private static final long serialVersionUID = 1L;
|
|
33
35
|
|
|
34
36
|
private <%= user.primaryKey.type %> id;
|
|
35
37
|
|
|
@@ -19,25 +19,17 @@
|
|
|
19
19
|
package <%= packageName %>.web.rest;
|
|
20
20
|
|
|
21
21
|
import <%= packageName %>.config.Constants;
|
|
22
|
-
<%_ if (!authenticationTypeOauth2) { _%>
|
|
23
22
|
import <%= packageName %>.domain.<%= asEntity('User') %>;
|
|
24
|
-
<%_ } _%>
|
|
25
|
-
<%_ if (!authenticationTypeOauth2) { _%>
|
|
26
23
|
import <%= packageName %>.repository.UserRepository;
|
|
27
|
-
<%_ } _%>
|
|
28
24
|
import <%= packageName %>.security.AuthoritiesConstants;
|
|
29
|
-
<%_ if (!authenticationTypeOauth2) { _%>
|
|
30
25
|
import <%= packageName %>.service.MailService;
|
|
31
26
|
import org.springframework.data.domain.Sort;
|
|
32
27
|
import java.util.Collections;
|
|
33
|
-
<%_ } _%>
|
|
34
28
|
import <%= packageName %>.service.UserService;
|
|
35
29
|
import <%= packageName %>.service.dto.<%= asDto('AdminUser') %>;
|
|
36
|
-
<%_ if (!authenticationTypeOauth2) { _%>
|
|
37
30
|
import <%= packageName %>.web.rest.errors.BadRequestAlertException;
|
|
38
31
|
import <%= packageName %>.web.rest.errors.EmailAlreadyUsedException;
|
|
39
32
|
import <%= packageName %>.web.rest.errors.LoginAlreadyUsedException;
|
|
40
|
-
<%_ } _%>
|
|
41
33
|
|
|
42
34
|
import tech.jhipster.web.util.HeaderUtil;
|
|
43
35
|
<%_ if (databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j || databaseTypeCouchbase) { _%>
|
|
@@ -78,18 +70,15 @@ import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
|
|
|
78
70
|
<%_ } _%>
|
|
79
71
|
|
|
80
72
|
import javax.validation.constraints.Pattern;
|
|
81
|
-
<%_ if (!authenticationTypeOauth2) { _%>
|
|
82
73
|
import javax.validation.Valid;
|
|
83
74
|
import java.net.URI;
|
|
84
75
|
import java.net.URISyntaxException;
|
|
85
|
-
<%_ } _%>
|
|
86
|
-
<%_ if (!reactive) { _%>
|
|
87
|
-
import java.util.*;
|
|
88
|
-
<%_ } _%>
|
|
89
76
|
<%_ if (reactive) { _%>
|
|
90
77
|
import java.util.ArrayList;
|
|
91
78
|
import java.util.List;
|
|
92
79
|
import java.util.Arrays;
|
|
80
|
+
<%_ } else { _%>
|
|
81
|
+
import java.util.*;
|
|
93
82
|
<%_ } _%>
|
|
94
83
|
<%_ if (searchEngineElasticsearch && !reactive) { _%>
|
|
95
84
|
import java.util.stream.Collectors;
|
|
@@ -101,7 +90,7 @@ import static org.elasticsearch.index.query.QueryBuilders.*;
|
|
|
101
90
|
/**
|
|
102
91
|
* REST controller for managing users.
|
|
103
92
|
* <p>
|
|
104
|
-
* This class accesses the {@link
|
|
93
|
+
* This class accesses the {@link <%= packageName %>.domain.<%= user.persistClass %>} entity, and needs to fetch its collection of authorities.
|
|
105
94
|
* <p>
|
|
106
95
|
* For a normal use-case, it would be better to have an eager relationship between User and Authority,
|
|
107
96
|
* and send everything to the client side: there would be no View Model and DTO, a lot less code, and an outer-join
|
|
@@ -125,10 +114,8 @@ import static org.elasticsearch.index.query.QueryBuilders.*;
|
|
|
125
114
|
@RestController
|
|
126
115
|
@RequestMapping("/api/admin")
|
|
127
116
|
public class UserResource {
|
|
128
|
-
<%_ if (!authenticationTypeOauth2) { _%>
|
|
129
117
|
private static final List<String> ALLOWED_ORDERED_PROPERTIES = Collections.unmodifiableList(Arrays.asList(
|
|
130
118
|
"id", "login", "firstName", "lastName", "email", "activated", "langKey", "createdBy", "createdDate", "lastModifiedBy", "lastModifiedDate"));
|
|
131
|
-
<%_ } _%>
|
|
132
119
|
|
|
133
120
|
private final Logger log = LoggerFactory.getLogger(UserResource.class);
|
|
134
121
|
|
|
@@ -136,22 +123,17 @@ public class UserResource {
|
|
|
136
123
|
private String applicationName;
|
|
137
124
|
|
|
138
125
|
private final UserService userService;
|
|
139
|
-
<%_ if (!authenticationTypeOauth2) { _%>
|
|
140
126
|
|
|
141
127
|
private final UserRepository userRepository;
|
|
142
128
|
|
|
143
129
|
private final MailService mailService;
|
|
144
|
-
<%_ } _%>
|
|
145
130
|
|
|
146
|
-
public UserResource(UserService userService
|
|
131
|
+
public UserResource(UserService userService, UserRepository userRepository, MailService mailService) {
|
|
147
132
|
this.userService = userService;
|
|
148
|
-
<%_ if (!authenticationTypeOauth2) { _%>
|
|
149
133
|
this.userRepository = userRepository;
|
|
150
134
|
this.mailService = mailService;
|
|
151
|
-
<%_ } _%>
|
|
152
135
|
}
|
|
153
136
|
|
|
154
|
-
<%_ if (!authenticationTypeOauth2) { _%>
|
|
155
137
|
/**
|
|
156
138
|
* {@code POST /admin/users} : Creates a new user.
|
|
157
139
|
* <p>
|
|
@@ -161,9 +143,9 @@ public class UserResource {
|
|
|
161
143
|
*
|
|
162
144
|
* @param userDTO the user to create.
|
|
163
145
|
* @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new user, or with status {@code 400 (Bad Request)} if the login or email is already in use.
|
|
164
|
-
|
|
146
|
+
<%_ if (!reactive) { _%>
|
|
165
147
|
* @throws URISyntaxException if the Location URI syntax is incorrect.
|
|
166
|
-
|
|
148
|
+
<%_ } _%>
|
|
167
149
|
* @throws BadRequestAlertException {@code 400 (Bad Request)} if the login or email is already in use.
|
|
168
150
|
*/
|
|
169
151
|
@PostMapping("/users")
|
|
@@ -174,7 +156,7 @@ public class UserResource {
|
|
|
174
156
|
if (userDTO.getId() != null) {
|
|
175
157
|
throw new BadRequestAlertException("A new user cannot already have an ID", "userManagement", "idexists");
|
|
176
158
|
// Lowercase the user login before comparing with database
|
|
177
|
-
|
|
159
|
+
<%_ if (reactive) { _%>
|
|
178
160
|
}
|
|
179
161
|
return userRepository.findOneByLogin(userDTO.getLogin().toLowerCase())
|
|
180
162
|
.hasElement()
|
|
@@ -201,7 +183,7 @@ public class UserResource {
|
|
|
201
183
|
throw new RuntimeException(e);
|
|
202
184
|
}
|
|
203
185
|
});
|
|
204
|
-
|
|
186
|
+
<%_ } else { _%>
|
|
205
187
|
} else if (userRepository.findOneByLogin(userDTO.getLogin().toLowerCase()).isPresent()) {
|
|
206
188
|
throw new LoginAlreadyUsedException();
|
|
207
189
|
} else if (userRepository.findOneByEmailIgnoreCase(userDTO.getEmail()).isPresent()) {
|
|
@@ -213,7 +195,7 @@ public class UserResource {
|
|
|
213
195
|
.headers(HeaderUtil.createAlert(applicationName, <% if (enableTranslation) { %> "userManagement.created"<% } else { %> "A user is created with identifier " + newUser.getLogin()<% } %>, newUser.getLogin()))
|
|
214
196
|
.body(newUser);
|
|
215
197
|
}
|
|
216
|
-
|
|
198
|
+
<%_ } _%>
|
|
217
199
|
}
|
|
218
200
|
|
|
219
201
|
/**
|
|
@@ -226,7 +208,7 @@ public class UserResource {
|
|
|
226
208
|
*/
|
|
227
209
|
@PutMapping("/users")
|
|
228
210
|
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
|
|
229
|
-
|
|
211
|
+
<%_ if (reactive) { _%>
|
|
230
212
|
public Mono<ResponseEntity<<%= asDto('AdminUser') %>>> updateUser(@Valid @RequestBody <%= asDto('AdminUser') %> userDTO) {
|
|
231
213
|
log.debug("REST request to update User : {}", userDTO);
|
|
232
214
|
return userRepository.findOneByEmailIgnoreCase(userDTO.getEmail())
|
|
@@ -251,7 +233,7 @@ public class UserResource {
|
|
|
251
233
|
.headers(HeaderUtil.createAlert(applicationName, <% if (enableTranslation) { %>"userManagement.updated"<% } else { %>"A user is updated with identifier " + userDTO.getLogin()<% } %>, userDTO.getLogin()))
|
|
252
234
|
.body(user)
|
|
253
235
|
);
|
|
254
|
-
|
|
236
|
+
<%_ } else { _%>
|
|
255
237
|
public ResponseEntity<<%= asDto('AdminUser') %>> updateUser(@Valid @RequestBody <%= asDto('AdminUser') %> userDTO) {
|
|
256
238
|
log.debug("REST request to update User : {}", userDTO);
|
|
257
239
|
Optional<<%= asEntity('User') %>> existingUser = userRepository.findOneByEmailIgnoreCase(userDTO.getEmail());
|
|
@@ -266,10 +248,9 @@ public class UserResource {
|
|
|
266
248
|
|
|
267
249
|
return ResponseUtil.wrapOrNotFound(updatedUser,
|
|
268
250
|
HeaderUtil.createAlert(applicationName, <% if (enableTranslation) { %>"userManagement.updated"<% } else { %>"A user is updated with identifier " + userDTO.getLogin()<% } %>, userDTO.getLogin()));
|
|
269
|
-
|
|
251
|
+
<%_ } _%>
|
|
270
252
|
}
|
|
271
253
|
|
|
272
|
-
<%_ } _%>
|
|
273
254
|
/**
|
|
274
255
|
* {@code GET /admin/users} : get all users with all the details - calling this are only allowed for the administrators.
|
|
275
256
|
*<% if (databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j || databaseTypeCouchbase) { %>
|
|
@@ -285,11 +266,9 @@ public class UserResource {
|
|
|
285
266
|
<%_ if (reactive) { _%>
|
|
286
267
|
public Mono<ResponseEntity<Flux<<%= asDto('AdminUser') %>>>> getAllUsers(@org.springdoc.api.annotations.ParameterObject ServerHttpRequest request, @org.springdoc.api.annotations.ParameterObject Pageable pageable) {
|
|
287
268
|
log.debug("REST request to get all User for an admin");
|
|
288
|
-
<%_ if (!authenticationTypeOauth2) { _%>
|
|
289
269
|
if (!onlyContainsAllowedProperties(pageable)) {
|
|
290
270
|
return Mono.just(ResponseEntity.badRequest().build());
|
|
291
271
|
}
|
|
292
|
-
<%_ } _%>
|
|
293
272
|
|
|
294
273
|
return userService.countManagedUsers()
|
|
295
274
|
.map(total -> new PageImpl<>(new ArrayList<>(), pageable, total))
|
|
@@ -298,11 +277,9 @@ public class UserResource {
|
|
|
298
277
|
<%_ } else { _%>
|
|
299
278
|
public ResponseEntity<List<<%= asDto('AdminUser') %>>> getAllUsers(@org.springdoc.api.annotations.ParameterObject Pageable pageable) {
|
|
300
279
|
log.debug("REST request to get all User for an admin");
|
|
301
|
-
<%_ if (!authenticationTypeOauth2) { _%>
|
|
302
280
|
if (!onlyContainsAllowedProperties(pageable)) {
|
|
303
281
|
return ResponseEntity.badRequest().build();
|
|
304
282
|
}
|
|
305
|
-
<%_ } _%>
|
|
306
283
|
|
|
307
284
|
final Page<<%= asDto('AdminUser') %>> page = userService.getAllManagedUsers(pageable);
|
|
308
285
|
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page);
|
|
@@ -310,11 +287,9 @@ public class UserResource {
|
|
|
310
287
|
<%_ } _%>
|
|
311
288
|
}
|
|
312
289
|
|
|
313
|
-
<%_ if (!authenticationTypeOauth2) { _%>
|
|
314
290
|
private boolean onlyContainsAllowedProperties(Pageable pageable) {
|
|
315
291
|
return pageable.getSort().stream().map(Sort.Order::getProperty).allMatch(ALLOWED_ORDERED_PROPERTIES::contains);
|
|
316
292
|
}
|
|
317
|
-
<%_ } _%>
|
|
318
293
|
|
|
319
294
|
<%_ } else { /* Cassandra */ _%>
|
|
320
295
|
public <% if (reactive) { %>Flux<% } else { %>List<% } %><<%= asDto('AdminUser') %>> getAllUsers() {
|
|
@@ -346,7 +321,6 @@ public class UserResource {
|
|
|
346
321
|
.map(<%= asDto('AdminUser') %>::new));
|
|
347
322
|
<%_ } _%>
|
|
348
323
|
}
|
|
349
|
-
<%_ if (!authenticationTypeOauth2) { _%>
|
|
350
324
|
|
|
351
325
|
/**
|
|
352
326
|
* {@code DELETE /admin/users/:login} : delete the "login" User.
|
|
@@ -356,17 +330,16 @@ public class UserResource {
|
|
|
356
330
|
*/
|
|
357
331
|
@DeleteMapping("/users/{login}")
|
|
358
332
|
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
|
|
359
|
-
|
|
333
|
+
<%_ if (reactive) { _%>
|
|
360
334
|
public Mono<ResponseEntity<Void>> deleteUser(@PathVariable @Pattern(regexp = Constants.LOGIN_REGEX) String login) {
|
|
361
335
|
log.debug("REST request to delete User: {}", login);
|
|
362
336
|
return userService.deleteUser(login)
|
|
363
337
|
.then(Mono.just(ResponseEntity.noContent().headers(HeaderUtil.createAlert( applicationName, <% if (enableTranslation) { %> "userManagement.deleted"<% } else { %> "A user is deleted with identifier " + login<% } %>, login)).build()));
|
|
364
|
-
|
|
338
|
+
<%_ } else { _%>
|
|
365
339
|
public ResponseEntity<Void> deleteUser(@PathVariable @Pattern(regexp = Constants.LOGIN_REGEX) String login) {
|
|
366
340
|
log.debug("REST request to delete User: {}", login);
|
|
367
341
|
userService.deleteUser(login);
|
|
368
342
|
return ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName, <% if (enableTranslation) { %> "userManagement.deleted"<% } else { %> "A user is deleted with identifier " + login<% } %>, login)).build();
|
|
369
|
-
<%_ } _%>
|
|
370
|
-
}
|
|
371
343
|
<%_ } _%>
|
|
344
|
+
}
|
|
372
345
|
}
|
|
@@ -25,6 +25,7 @@ import java.net.URI;
|
|
|
25
25
|
import java.util.HashMap;
|
|
26
26
|
import java.util.Map;
|
|
27
27
|
|
|
28
|
+
@SuppressWarnings("java:S110") // Inheritance tree of classes should not be too deep
|
|
28
29
|
public class BadRequestAlertException extends AbstractThrowableProblem {
|
|
29
30
|
|
|
30
31
|
private static final long serialVersionUID = 1L;
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
-%>
|
|
19
19
|
package <%= packageName %>.web.rest.errors;
|
|
20
20
|
|
|
21
|
+
@SuppressWarnings("java:S110") // Inheritance tree of classes should not be too deep
|
|
21
22
|
public class EmailAlreadyUsedException extends BadRequestAlertException {
|
|
22
23
|
|
|
23
24
|
private static final long serialVersionUID = 1L;
|
|
@@ -21,6 +21,7 @@ package <%= packageName %>.web.rest.errors;
|
|
|
21
21
|
import org.zalando.problem.AbstractThrowableProblem;
|
|
22
22
|
import org.zalando.problem.Status;
|
|
23
23
|
|
|
24
|
+
@SuppressWarnings("java:S110") // Inheritance tree of classes should not be too deep
|
|
24
25
|
public class InvalidPasswordException extends AbstractThrowableProblem {
|
|
25
26
|
|
|
26
27
|
private static final long serialVersionUID = 1L;
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
-%>
|
|
19
19
|
package <%= packageName %>.web.rest.errors;
|
|
20
20
|
|
|
21
|
+
@SuppressWarnings("java:S110") // Inheritance tree of classes should not be too deep
|
|
21
22
|
public class LoginAlreadyUsedException extends BadRequestAlertException {
|
|
22
23
|
|
|
23
24
|
private static final long serialVersionUID = 1L;
|
|
@@ -251,7 +251,7 @@ spring:
|
|
|
251
251
|
<%_ } _%>
|
|
252
252
|
thymeleaf:
|
|
253
253
|
cache: false
|
|
254
|
-
<%_ if (
|
|
254
|
+
<%_ if (serviceDiscoveryAny || applicationTypeGateway || applicationTypeMicroservice) { _%>
|
|
255
255
|
sleuth:
|
|
256
256
|
# https://github.com/spring-projects/spring-framework/issues/27844#issuescomment-1002866885
|
|
257
257
|
# https://github.com/spring-cloud/spring-cloud-sleuth/issues/2094
|
|
@@ -207,7 +207,7 @@ spring:
|
|
|
207
207
|
<%_ } _%>
|
|
208
208
|
thymeleaf:
|
|
209
209
|
cache: true
|
|
210
|
-
<%_ if (
|
|
210
|
+
<%_ if (serviceDiscoveryAny || applicationTypeGateway || applicationTypeMicroservice) { _%>
|
|
211
211
|
sleuth:
|
|
212
212
|
# https://github.com/spring-projects/spring-framework/issues/27844#issuescomment-1002866885
|
|
213
213
|
# https://github.com/spring-cloud/spring-cloud-sleuth/issues/2094
|
|
@@ -258,7 +258,7 @@ server:
|
|
|
258
258
|
# ===================================================================
|
|
259
259
|
|
|
260
260
|
jhipster:
|
|
261
|
-
<%_ if (applicationTypeGateway && cacheProviderHazelcast &&
|
|
261
|
+
<%_ if (applicationTypeGateway && cacheProviderHazelcast && serviceDiscoveryAny) { _%>
|
|
262
262
|
gateway:
|
|
263
263
|
rate-limiting:
|
|
264
264
|
enabled: false
|
|
@@ -368,10 +368,12 @@ jhipster:
|
|
|
368
368
|
license: unlicensed
|
|
369
369
|
license-url:
|
|
370
370
|
security:
|
|
371
|
-
<%_ if
|
|
371
|
+
<%_ if(!skipClient) { _%>
|
|
372
|
+
<%_ if (clientTheme !== 'none') { _%>
|
|
372
373
|
content-security-policy: "default-src 'self'; frame-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://storage.googleapis.com; style-src 'self' https://fonts.googleapis.com 'unsafe-inline'; img-src 'self' data:; font-src 'self' https://fonts.gstatic.com data:"
|
|
373
|
-
<%_ } else { _%>
|
|
374
|
+
<%_ } else { _%>
|
|
374
375
|
content-security-policy: "default-src 'self'; frame-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://storage.googleapis.com; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:"
|
|
376
|
+
<%_ } _%>
|
|
375
377
|
<%_ } _%>
|
|
376
378
|
<%_ if (authenticationTypeOauth2) { _%>
|
|
377
379
|
oauth2:
|
|
@@ -12,17 +12,12 @@
|
|
|
12
12
|
<property name="uuidType" value="uuid" dbms="h2"/>
|
|
13
13
|
<%_ } _%>
|
|
14
14
|
<property name="datetimeType" value="datetime" dbms="h2"/>
|
|
15
|
-
<%_ if (
|
|
16
|
-
<property name="clobType" value="varchar(1000000)" dbms="h2"/>
|
|
17
|
-
<property name="blobType" value="varchar(1000000)" dbms="h2"/>
|
|
18
|
-
<%_ } else { _%>
|
|
19
|
-
<%_ if (prodDatabaseTypePostgres) { _%>
|
|
15
|
+
<%_ if (prodDatabaseTypePostgres) { _%>
|
|
20
16
|
<property name="clobType" value="longvarchar" dbms="h2"/>
|
|
21
|
-
|
|
17
|
+
<%_ } else { _%>
|
|
22
18
|
<property name="clobType" value="clob" dbms="h2"/>
|
|
23
|
-
<%_ } _%>
|
|
24
|
-
<property name="blobType" value="blob" dbms="h2"/>
|
|
25
19
|
<%_ } _%>
|
|
20
|
+
<property name="blobType" value="blob" dbms="h2"/>
|
|
26
21
|
<%_ } _%>
|
|
27
22
|
<%_ if (devDatabaseTypeMysql || prodDatabaseTypeMysql) { _%>
|
|
28
23
|
<property name="now" value="now()" dbms="mysql"/>
|
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
<!DOCTYPE configuration>
|
|
21
21
|
|
|
22
22
|
<configuration scan="true">
|
|
23
|
+
<!-- Patterns based on https://github.com/spring-projects/spring-boot/blob/v2.7.2/spring-boot-project/spring-boot/src/main/resources/org/springframework/boot/logging/logback/defaults.xml -->
|
|
24
|
+
<conversionRule conversionWord="crlf" converterClass="<%= packageName %>.config.CRLFLogConverter" />
|
|
25
|
+
<property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd'T'HH:mm:ss.SSSXXX}}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %crlf(%m){red} %n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
|
26
|
+
<property name="FILE_LOG_PATTERN" value="${FILE_LOG_PATTERN:-%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} : %crlf(%m) %n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
|
27
|
+
|
|
23
28
|
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
|
24
29
|
|
|
25
30
|
<!-- The FILE and ASYNC appenders are here as examples for a production configuration -->
|
|
@@ -22,13 +22,13 @@ import javax.annotation.PostConstruct;
|
|
|
22
22
|
|
|
23
23
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
24
24
|
import org.springframework.context.annotation.Configuration;
|
|
25
|
-
import org.springframework.data.elasticsearch.core
|
|
25
|
+
import org.springframework.data.elasticsearch.core.<%= reactive ? 'ReactiveElasticsearchTemplate' : 'ElasticsearchRestTemplate' %>;
|
|
26
26
|
import org.springframework.data.elasticsearch.core.RefreshPolicy;
|
|
27
27
|
|
|
28
28
|
@Configuration
|
|
29
|
-
public class
|
|
29
|
+
public class ElasticsearchTestConfiguration {
|
|
30
30
|
@Autowired
|
|
31
|
-
ReactiveElasticsearchTemplate template;
|
|
31
|
+
<%= reactive ? 'ReactiveElasticsearchTemplate' : 'ElasticsearchRestTemplate' %> template;
|
|
32
32
|
|
|
33
33
|
@PostConstruct
|
|
34
34
|
public void configureTemplate() {
|
package/generators/server/templates/src/test/java/package/config/ElasticsearchTestContainer.java.ejs
CHANGED
|
@@ -53,6 +53,7 @@ public class ElasticsearchTestContainer implements InitializingBean, DisposableB
|
|
|
53
53
|
.withStartupTimeout(Duration.of(CONTAINER_STARTUP_TIMEOUT_MINUTES, ChronoUnit.MINUTES))
|
|
54
54
|
.withSharedMemorySize(256000000L)
|
|
55
55
|
.withEnv("ES_JAVA_OPTS", "-Xms256m -Xmx256m")
|
|
56
|
+
.withEnv("xpack.security.enabled", "false")
|
|
56
57
|
.withLogConsumer(new Slf4jLogConsumer(log))
|
|
57
58
|
.withReuse(true);
|
|
58
59
|
}
|
|
@@ -39,6 +39,9 @@ public class JHipsterBlockHoundIntegration implements BlockHoundIntegration {
|
|
|
39
39
|
builder.allowBlockingCallsInside("org.mariadb.r2dbc.message.client.HandshakeResponse", "writeConnectAttributes");
|
|
40
40
|
builder.allowBlockingCallsInside("org.mariadb.r2dbc.client.MariadbPacketDecoder", "decode");
|
|
41
41
|
<%_} _%>
|
|
42
|
+
<%_ if (devDatabaseTypeMssql || prodDatabaseTypeMssql) { _%>
|
|
43
|
+
builder.allowBlockingCallsInside("io.r2dbc.mssql.client.ssl.TdsSslHandler", "createSslHandler");
|
|
44
|
+
<%_} _%>
|
|
42
45
|
<%_ if (searchEngineElasticsearch) { _%>
|
|
43
46
|
builder.allowBlockingCallsInside("org.elasticsearch.client.indices.CreateIndexRequest", "settings");
|
|
44
47
|
<%_} _%>
|
|
@@ -145,7 +145,7 @@ public class TestContainersSpringContextCustomizerFactory implements ContextCust
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
<%_ if (reactive) { _%>
|
|
148
|
-
testValues = testValues.and("spring.r2dbc.url=" + devTestContainer.getTestContainer().getJdbcUrl().replace("jdbc", "r2dbc")<% if (devDatabaseTypeMysql) { %>.replace("mysql", "mariadb")<% } %> + "<%- getDBCExtraOption(devDatabaseType) %>");
|
|
148
|
+
testValues = testValues.and("spring.r2dbc.url=" + devTestContainer.getTestContainer().getJdbcUrl().replace("jdbc", "r2dbc")<% if (devDatabaseTypeMysql) { %>.replace("mysql", "mariadb")<% } else if (devDatabaseTypeMssql) { %>.replace(";encrypt=false", "")<% } %> + "<%- getDBCExtraOption(devDatabaseType) %>");
|
|
149
149
|
testValues = testValues.and("spring.r2dbc.username=" + devTestContainer.getTestContainer().getUsername());
|
|
150
150
|
testValues = testValues.and("spring.r2dbc.password=" + devTestContainer.getTestContainer().getPassword());
|
|
151
151
|
testValues = testValues.and("spring.liquibase.url=" + devTestContainer.getTestContainer().getJdbcUrl() + "<%- getDBCExtraOption(devDatabaseType) %>" );
|
|
@@ -169,7 +169,7 @@ public class TestContainersSpringContextCustomizerFactory implements ContextCust
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
<%_ if (reactive) { _%>
|
|
172
|
-
testValues = testValues.and("spring.r2dbc.url=" + prodTestContainer.getTestContainer().getJdbcUrl().replace("jdbc", "r2dbc")<% if (prodDatabaseTypeMysql) { %>.replace("mysql", "mariadb")<% } %> + "<%- getDBCExtraOption(prodDatabaseType) %>");
|
|
172
|
+
testValues = testValues.and("spring.r2dbc.url=" + prodTestContainer.getTestContainer().getJdbcUrl().replace("jdbc", "r2dbc")<% if (prodDatabaseTypeMysql) { %>.replace("mysql", "mariadb")<% } else if (prodDatabaseTypeMssql) { %>.replace(";encrypt=false", "")<% } %> + "<%- getDBCExtraOption(prodDatabaseType) %>");
|
|
173
173
|
testValues = testValues.and("spring.r2dbc.username=" + prodTestContainer.getTestContainer().getUsername());
|
|
174
174
|
testValues = testValues.and("spring.r2dbc.password=" + prodTestContainer.getTestContainer().getPassword());
|
|
175
175
|
testValues = testValues.and("spring.liquibase.url=" + prodTestContainer.getTestContainer().getJdbcUrl() + "<%- getDBCExtraOption(prodDatabaseType) %>");
|