generator-jhipster 7.4.1 → 7.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/generators/app/index.js +11 -1
- package/generators/cleanup.js +27 -171
- package/generators/client/files-angular.js +6 -1
- package/generators/client/files-vue.js +5 -1
- package/generators/client/index.js +2 -1
- package/generators/client/templates/angular/angular.json.ejs +5 -0
- package/generators/client/templates/angular/jest.conf.js.ejs +2 -0
- package/generators/client/templates/angular/package.json +24 -24
- package/generators/client/templates/angular/package.json.ejs +3 -1
- package/generators/client/templates/angular/src/main/webapp/app/account/activate/activate.component.ts.ejs +4 -4
- package/generators/client/templates/angular/src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.ts.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/account/password/password.component.ts.ejs +4 -4
- package/generators/client/templates/angular/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.ts.ejs +4 -4
- package/generators/client/templates/angular/src/main/webapp/app/account/register/register.component.spec.ts.ejs +10 -9
- package/generators/client/templates/angular/src/main/webapp/app/account/register/register.component.ts.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/account/settings/settings.component.spec.ts.ejs +8 -6
- package/generators/client/templates/angular/src/main/webapp/app/admin/health/health.component.ts.ejs +4 -4
- package/generators/client/templates/angular/src/main/webapp/app/admin/user-management/list/user-management.component.spec.ts.ejs +4 -4
- package/generators/client/templates/angular/src/main/webapp/app/admin/user-management/list/user-management.component.ts.ejs +4 -4
- package/generators/client/templates/angular/src/main/webapp/app/admin/user-management/update/user-management-update.component.ts.ejs +8 -8
- package/generators/client/templates/angular/src/main/webapp/app/app-routing.module.ts.ejs +14 -3
- package/generators/client/templates/angular/src/main/webapp/app/app.module.ts.ejs +8 -29
- package/generators/client/templates/angular/src/main/webapp/app/config/datepicker-adapter.ts.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/config/dayjs.ts.ejs +4 -4
- package/generators/client/templates/angular/src/main/webapp/app/core/auth/account.service.spec.ts.ejs +14 -9
- package/generators/client/templates/angular/src/main/webapp/app/core/tracker/tracker.service.ts.ejs +6 -6
- 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/entities/entity-navbar-items.ts.ejs +29 -0
- package/generators/client/templates/angular/src/main/webapp/app/home/home.component.spec.ts.ejs +14 -4
- package/generators/client/templates/angular/src/main/webapp/app/layouts/main/main.component.ts.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/layouts/navbar/navbar.component.html.ejs +20 -0
- package/generators/client/templates/angular/src/main/webapp/app/layouts/navbar/navbar.component.spec.ts.ejs +10 -4
- package/generators/client/templates/angular/src/main/webapp/app/layouts/navbar/navbar.component.ts.ejs +41 -2
- package/generators/client/templates/angular/src/main/webapp/app/login/login.component.spec.ts.ejs +3 -2
- package/generators/client/templates/angular/src/main/webapp/app/login/login.component.ts.ejs +4 -4
- package/generators/client/templates/angular/src/main/webapp/app/shared/auth/has-any-authority.directive.spec.ts.ejs +4 -4
- package/generators/client/templates/angular/src/main/webapp/app/shared/date/duration.pipe.ts.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/shared/date/format-medium-date.pipe.spec.ts.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/shared/date/format-medium-date.pipe.ts.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/shared/date/format-medium-datetime.pipe.spec.ts.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/shared/date/format-medium-datetime.pipe.ts.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/shared/language/translate.directive.ts.ejs +6 -6
- package/generators/client/templates/angular/src/main/webapp/app/shared/language/translation.module.ts.ejs +83 -0
- package/generators/client/templates/angular/src/main/webapp/declarations.d.ts.ejs +16 -2
- package/generators/client/templates/angular/tsconfig.json.ejs +2 -0
- package/generators/client/templates/angular/tsconfig.spec.json.ejs +0 -1
- package/generators/client/templates/angular/webpack/proxy.conf.js.ejs +0 -2
- package/generators/client/templates/angular/webpack/webpack.custom.js.ejs +0 -16
- package/generators/client/templates/angular/webpack/webpack.microfrontend.js.ejs +12 -5
- package/generators/client/templates/common/package.json +2 -2
- package/generators/client/templates/common/src/main/webapp/robots.txt.ejs +0 -1
- package/generators/client/templates/common/src/main/webapp/swagger-ui/index.html.ejs +86 -56
- package/generators/client/templates/react/package.json +27 -27
- package/generators/client/templates/react/package.json.ejs +2 -0
- package/generators/client/templates/react/src/main/webapp/app/config/axios-interceptor.spec.ts.ejs +3 -2
- package/generators/client/templates/react/src/main/webapp/app/shared/layout/header/header.scss.ejs +9 -0
- package/generators/client/templates/react/src/main/webapp/app/shared/layout/header/header.tsx.ejs +1 -1
- package/generators/client/templates/react/src/main/webapp/app/shared/reducers/authentication.spec.ts.ejs +1 -1
- package/generators/client/templates/react/webpack/webpack.dev.js.ejs +0 -2
- package/generators/client/templates/vue/package.json +22 -22
- package/generators/client/templates/vue/package.json.ejs +3 -3
- package/generators/client/templates/vue/src/main/webapp/app/account/account.service.ts.ejs +19 -9
- package/generators/client/templates/vue/src/main/webapp/app/entities/entities.component.ts.ejs +6 -0
- package/generators/client/templates/vue/src/main/webapp/app/entities/user/{user.oauth2.service.ts.ejs → user.service.ts.ejs} +1 -1
- package/generators/client/templates/vue/src/main/webapp/app/main.ts.ejs +0 -8
- package/generators/client/templates/vue/src/test/javascript/spec/app/admin/user-management/user-management-edit.component.spec.ts.ejs +4 -4
- package/generators/client/templates/vue/src/test/javascript/spec/app/admin/user-management/user-management.component.spec.ts.ejs +2 -2
- package/generators/client/templates/vue/webpack/webpack.common.js.ejs +0 -2
- package/generators/common/templates/README.md.jhi.ejs +1 -3
- package/generators/common/templates/package.json +3 -3
- package/generators/cypress/templates/cypress.json.ejs +9 -2
- package/generators/cypress/templates/src/test/javascript/cypress/integration/account/login-page.spec.ts.ejs +3 -14
- package/generators/cypress/templates/src/test/javascript/cypress/integration/account/password-page.spec.ts.ejs +33 -39
- package/generators/cypress/templates/src/test/javascript/cypress/integration/account/register-page.spec.ts.ejs +52 -62
- package/generators/cypress/templates/src/test/javascript/cypress/integration/account/reset-password-page.spec.ts.ejs +2 -10
- package/generators/cypress/templates/src/test/javascript/cypress/integration/account/settings-page.spec.ts.ejs +25 -34
- package/generators/cypress/templates/src/test/javascript/cypress/integration/administration/administration.spec.ts.ejs +1 -22
- package/generators/cypress/templates/src/test/javascript/cypress/support/commands.ts.ejs +38 -6
- package/generators/cypress/templates/src/test/javascript/cypress/support/index.ts.ejs +1 -6
- package/generators/cypress/templates/src/test/javascript/cypress/support/navbar.ts.ejs +7 -7
- package/generators/cypress/templates/src/test/javascript/cypress/support/oauth2.ts.ejs +0 -9
- package/generators/docker-compose/templates/realm-config/jhipster-realm.json.ejs +1 -1
- package/generators/entity/index.js +45 -3
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/delete/entity-management-delete-dialog.component.spec.ts.ejs +1 -1
- 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/entity-management.module.ts.ejs +1 -35
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/entity.model.ts.ejs +1 -1
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/list/entity-management.component.html.ejs +4 -4
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/list/entity-management.component.spec.ts.ejs +8 -8
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/list/entity-management.component.ts.ejs +1 -1
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/list/infinite-scroll-template.ejs +8 -8
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/list/no-pagination-template.ejs +8 -8
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/list/pagination-template.ejs +8 -8
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/route/entity-management-routing-resolve.service.spec.ts.ejs +15 -6
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/service/entity.service.spec.ts.ejs +1 -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-management-update.component.spec.ts.ejs +12 -5
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/update/entity-management-update.component.ts.ejs +5 -5
- package/generators/entity-client/templates/angular/src/test/javascript/e2e/entities/entity.spec.ts.ejs +1 -1
- package/generators/entity-client/templates/common/src/test/javascript/cypress/integration/entity/entity.spec.ts.ejs +14 -37
- package/generators/entity-client/templates/react/src/main/webapp/app/entities/entity.reducer.ts.ejs +5 -4
- package/generators/entity-client/templates/vue/src/main/webapp/app/entities/entity-update.component.ts.ejs +23 -19
- package/generators/entity-client/templates/vue/src/test/javascript/spec/app/entities/entity-update.component.spec.ts.ejs +4 -6
- package/generators/entity-server/files.js +10 -0
- 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/common/search_template.ejs +1 -1
- package/generators/entity-server/templates/src/main/java/package/domain/Entity.java.jhi.ejs +5 -8
- package/generators/entity-server/templates/src/main/java/package/repository/search/EntitySearchRepository.java.ejs +18 -2
- package/generators/entity-server/templates/src/main/java/package/repository/search/SortToFieldSortBuilderConverter.java.ejs +24 -0
- package/generators/entity-server/templates/src/main/java/package/service/dto/EntityDTO.java.ejs +4 -6
- package/generators/entity-server/templates/src/main/java/package/web/rest/EntityResource.java.ejs +2 -2
- package/generators/entity-server/templates/src/test/java/package/web/rest/EntityResourceIT.java.ejs +2 -2
- package/generators/generator-base-private.js +2 -1
- package/generators/generator-base.js +13 -3
- package/generators/generator-constants.js +7 -7
- package/generators/server/__snapshots__/generator.spec.mjs.snap +16 -15
- package/generators/server/cleanup.js +151 -0
- package/generators/server/files.js +16 -14
- package/generators/server/index.js +34 -23
- package/generators/server/templates/build.gradle.ejs +214 -188
- package/generators/server/templates/gradle.properties.ejs +8 -8
- package/generators/server/templates/npmw +7 -5
- package/generators/server/templates/npmw.cmd +12 -7
- package/generators/server/templates/pom.xml.ejs +419 -329
- package/generators/server/templates/src/main/docker/config/realm-config/jhipster-realm.json.ejs +2 -2
- package/generators/server/templates/src/main/java/package/config/LocaleConfiguration.java.ejs +3 -2
- package/generators/server/templates/src/main/java/package/config/OpenApiConfiguration.java.ejs +17 -54
- package/generators/server/templates/src/main/java/package/config/SecurityConfiguration.java.ejs +5 -5
- package/generators/server/templates/src/main/java/package/config/SecurityConfiguration_reactive.java.ejs +3 -5
- package/generators/server/templates/src/main/java/package/config/WebConfigurer.java.ejs +0 -2
- package/generators/server/templates/src/main/java/package/config/neo4j/Neo4jMigrations.java.ejs +19 -9
- package/generators/server/templates/src/main/java/package/repository/AuthorityRepository.java.ejs +2 -2
- package/generators/server/templates/src/main/java/package/repository/UserRepository.java.ejs +0 -2
- package/generators/server/templates/src/main/java/package/security/jwt/TokenProvider.java.ejs +6 -4
- package/generators/server/templates/src/main/java/package/security/oauth2/CustomClaimConverter.java.ejs +2 -2
- package/generators/server/templates/src/main/java/package/service/UserService.java.ejs +3 -3
- package/generators/server/templates/src/main/java/package/service/dto/UserDTO.java.ejs +6 -6
- package/generators/server/templates/src/main/java/package/web/filter/ModifyServersOpenApiFilter.java.ejs +3 -2
- package/generators/server/templates/src/main/java/package/web/filter/SpaWebFilter.java.ejs +1 -1
- package/generators/server/templates/src/main/java/package/web/rest/PublicUserResource.java.ejs +2 -2
- package/generators/server/templates/src/main/java/package/web/rest/UserResource.java.ejs +2 -2
- package/generators/server/templates/src/main/resources/config/application.yml.ejs +17 -3
- package/generators/server/templates/src/main/resources/logback-spring.xml.ejs +1 -2
- package/generators/server/templates/src/test/java/package/cucumber/CucumberIT.java.ejs +2 -6
- package/generators/server/templates/src/test/java/package/cucumber/CucumberTestContextConfiguration.java.ejs +2 -3
- package/generators/server/templates/src/test/java/package/cucumber/stepdefs/UserStepDefs.java.ejs +41 -6
- package/generators/server/templates/src/test/java/package/management/SecurityMetersServiceTests.java.ejs +7 -7
- package/generators/server/templates/src/test/java/package/security/jwt/TokenProviderSecurityMetersTests.java.ejs +10 -10
- package/generators/server/templates/src/test/java/package/security/oauth2/AuthorizationHeaderUtilTest.java.ejs +1 -1
- package/generators/server/templates/src/test/java/package/service/MailServiceIT.java.ejs +1 -1
- package/generators/server/templates/src/test/java/package/web/rest/AccountResourceIT.java.ejs +2 -3
- package/generators/server/templates/src/test/java/package/web/rest/ClientForwardControllerTest.java.ejs +9 -0
- package/generators/server/templates/src/test/resources/junit-platform.properties.ejs +2 -0
- package/generators/server/templates/src/test/resources/logback.xml.ejs +1 -1
- package/generators/server/templates/src/test/{features → resources/package/features}/gitkeep +0 -0
- package/generators/server/templates/src/test/{features → resources/package/features}/user/user.feature.ejs +0 -0
- package/generators/spring-controller/templates/src/test/java/package/web/rest/ResourceIT.java.ejs +1 -1
- package/package.json +9 -9
- package/utils/entity.js +1 -5
- package/generators/server/templates/src/main/java/package/config/apidocs/GatewaySwaggerResourcesProvider.java.ejs +0 -91
- package/generators/server/templates/src/test/java/package/config/apidocs/GatewaySwaggerResourcesProviderTest.java.ejs +0 -79
- package/generators/server/templates/src/test/resources/cucumber.properties.ejs +0 -1
package/generators/server/templates/src/main/docker/config/realm-config/jhipster-realm.json.ejs
CHANGED
|
@@ -321,7 +321,7 @@
|
|
|
321
321
|
"security-admin-console": [],
|
|
322
322
|
"web_app": [],
|
|
323
323
|
"admin-cli": [],
|
|
324
|
-
"account-console": [],<% if (
|
|
324
|
+
"account-console": [],<% if (serviceDiscoveryEureka) { %>
|
|
325
325
|
"jhipster-registry": [],<% } %>
|
|
326
326
|
"broker": [
|
|
327
327
|
{
|
|
@@ -2491,7 +2491,7 @@
|
|
|
2491
2491
|
"clientOfflineSessionIdleTimeout": "0",
|
|
2492
2492
|
"cibaInterval": "5"
|
|
2493
2493
|
},
|
|
2494
|
-
"keycloakVersion": "
|
|
2494
|
+
"keycloakVersion": "16.1.0",
|
|
2495
2495
|
"userManagedAccessAllowed": false,
|
|
2496
2496
|
"clientProfiles": {
|
|
2497
2497
|
"profiles": []
|
package/generators/server/templates/src/main/java/package/config/LocaleConfiguration.java.ejs
CHANGED
|
@@ -198,8 +198,9 @@ public class LocaleConfiguration {
|
|
|
198
198
|
"'" + (timeZone != null ? " and time zone '" + timeZone.getID() + "'" : ""));
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
if (locale != null) {
|
|
202
|
+
exchange.getAttributes().put(LOCALE_REQUEST_ATTRIBUTE_NAME, locale);
|
|
203
|
+
}
|
|
203
204
|
if (timeZone != null) {
|
|
204
205
|
exchange.getAttributes().put(TIME_ZONE_REQUEST_ATTRIBUTE_NAME, timeZone);
|
|
205
206
|
} else {
|
package/generators/server/templates/src/main/java/package/config/OpenApiConfiguration.java.ejs
CHANGED
|
@@ -18,72 +18,35 @@
|
|
|
18
18
|
-%>
|
|
19
19
|
package <%= packageName %>.config;
|
|
20
20
|
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
|
|
21
|
+
import org.springdoc.core.GroupedOpenApi;
|
|
22
|
+
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
23
|
+
|
|
24
24
|
import org.springframework.context.annotation.Bean;
|
|
25
25
|
import org.springframework.context.annotation.Configuration;
|
|
26
26
|
import org.springframework.context.annotation.Profile;
|
|
27
|
-
import org.springframework.data.domain.Pageable;
|
|
28
|
-
import org.springframework.http.ResponseEntity;
|
|
29
|
-
import springfox.documentation.builders.RequestHandlerSelectors;
|
|
30
|
-
import springfox.documentation.service.ApiInfo;
|
|
31
|
-
import springfox.documentation.service.Contact;
|
|
32
|
-
import springfox.documentation.spi.DocumentationType;
|
|
33
|
-
import springfox.documentation.spring.web.plugins.Docket;
|
|
34
27
|
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import java.util.HashSet;
|
|
39
|
-
|
|
40
|
-
import static springfox.documentation.builders.PathSelectors.regex;
|
|
28
|
+
import tech.jhipster.config.JHipsterConstants;
|
|
29
|
+
import tech.jhipster.config.JHipsterProperties;
|
|
30
|
+
import tech.jhipster.config.apidoc.customizer.JHipsterOpenApiCustomizer;
|
|
41
31
|
|
|
42
32
|
@Configuration
|
|
43
33
|
@Profile(JHipsterConstants.SPRING_PROFILE_API_DOCS)
|
|
44
34
|
public class OpenApiConfiguration {
|
|
45
35
|
|
|
46
|
-
|
|
47
|
-
public SpringfoxCustomizer noApiFirstCustomizer() {
|
|
48
|
-
return docket -> docket.select()
|
|
49
|
-
.apis(RequestHandlerSelectors.basePackage("<%= packageName %>.web.api").negate());
|
|
50
|
-
}
|
|
36
|
+
public static final String API_FIRST_PACKAGE = "<%= packageName %>.web.api";
|
|
51
37
|
|
|
52
38
|
@Bean
|
|
53
|
-
|
|
39
|
+
@ConditionalOnMissingBean(name = "apiFirstGroupedOpenAPI")
|
|
40
|
+
public GroupedOpenApi apiFirstGroupedOpenAPI(
|
|
41
|
+
JHipsterOpenApiCustomizer jhipsterOpenApiCustomizer,
|
|
42
|
+
JHipsterProperties jHipsterProperties
|
|
43
|
+
) {
|
|
54
44
|
JHipsterProperties.ApiDocs properties = jHipsterProperties.getApiDocs();
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
ApiInfo apiInfo = new ApiInfo(
|
|
62
|
-
"API First " + properties.getTitle(),
|
|
63
|
-
properties.getDescription(),
|
|
64
|
-
properties.getVersion(),
|
|
65
|
-
properties.getTermsOfServiceUrl(),
|
|
66
|
-
contact,
|
|
67
|
-
properties.getLicense(),
|
|
68
|
-
properties.getLicenseUrl(),
|
|
69
|
-
new ArrayList<>()
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
return new Docket(DocumentationType.OAS_30)
|
|
73
|
-
.groupName("openapi")
|
|
74
|
-
.host(properties.getHost())
|
|
75
|
-
.protocols(new HashSet<>(Arrays.asList(properties.getProtocols())))
|
|
76
|
-
.apiInfo(apiInfo)
|
|
77
|
-
.useDefaultResponseMessages(properties.isUseDefaultResponseMessages())
|
|
78
|
-
.forCodeGeneration(true)
|
|
79
|
-
.directModelSubstitute(ByteBuffer.class, String.class)
|
|
80
|
-
.genericModelSubstitutes(ResponseEntity.class)
|
|
81
|
-
.ignoredParameterTypes(Pageable.class)
|
|
82
|
-
.select()
|
|
83
|
-
.apis(RequestHandlerSelectors.basePackage("<%= packageName %>.web.api"))
|
|
84
|
-
.paths(regex(properties.getDefaultIncludePattern()))
|
|
45
|
+
return GroupedOpenApi.builder()
|
|
46
|
+
.group("openapi")
|
|
47
|
+
.addOpenApiCustomiser(jhipsterOpenApiCustomizer)
|
|
48
|
+
.packagesToScan(API_FIRST_PACKAGE)
|
|
49
|
+
.pathsToMatch(properties.getDefaultIncludePattern())
|
|
85
50
|
.build();
|
|
86
51
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
52
|
}
|
package/generators/server/templates/src/main/java/package/config/SecurityConfiguration.java.ejs
CHANGED
|
@@ -268,14 +268,14 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
|
|
268
268
|
<%_ if (applicationTypeMonolith) { _%>
|
|
269
269
|
.and()
|
|
270
270
|
.httpBasic()
|
|
271
|
-
|
|
271
|
+
<%_ } _%>
|
|
272
272
|
.and()
|
|
273
273
|
.apply(securityConfigurerAdapter());
|
|
274
|
-
|
|
275
|
-
|
|
274
|
+
<%_ } else if (authenticationTypeOauth2) { _%>
|
|
275
|
+
<%_ if (applicationTypeMonolith) { _%>
|
|
276
276
|
.and()
|
|
277
277
|
.oauth2Login()
|
|
278
|
-
|
|
278
|
+
<%_ } _%>
|
|
279
279
|
.and()
|
|
280
280
|
.oauth2ResourceServer()
|
|
281
281
|
.jwt()
|
|
@@ -283,7 +283,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
|
|
283
283
|
.and()
|
|
284
284
|
.and()
|
|
285
285
|
.oauth2Client();
|
|
286
|
-
|
|
286
|
+
<%_ } _%>
|
|
287
287
|
// @formatter:on
|
|
288
288
|
}
|
|
289
289
|
<%_ if (authenticationTypeJwt) { _%>
|
|
@@ -211,7 +211,7 @@ public class SecurityConfiguration {
|
|
|
211
211
|
// @formatter:off
|
|
212
212
|
http
|
|
213
213
|
.securityMatcher(new NegatedServerWebExchangeMatcher(new OrServerWebExchangeMatcher(
|
|
214
|
-
pathMatchers("/app/**", "/i18n/**", "/content/**", "/swagger-ui/**", "/
|
|
214
|
+
pathMatchers("/app/**", "/i18n/**", "/content/**", "/swagger-ui/**", "/v3/api-docs/**", "/test/**"),
|
|
215
215
|
pathMatchers(HttpMethod.OPTIONS, "/**")
|
|
216
216
|
)))
|
|
217
217
|
.csrf()
|
|
@@ -278,11 +278,9 @@ public class SecurityConfiguration {
|
|
|
278
278
|
.pathMatchers("/api/admin/**").hasAuthority(AuthoritiesConstants.ADMIN)
|
|
279
279
|
.pathMatchers("/api/**").authenticated()
|
|
280
280
|
<%_ if (applicationTypeGateway) { _%>
|
|
281
|
-
<%_ if (microfrontend && (authenticationTypeJwt || clientFrameworkVue)) { _%>
|
|
282
281
|
// microfrontend resources are loaded by webpack without authentication, they need to be public
|
|
283
282
|
.pathMatchers("/services/*/*.js").permitAll()
|
|
284
283
|
.pathMatchers("/services/*/*.js.map").permitAll()
|
|
285
|
-
<%_ } _%>
|
|
286
284
|
.pathMatchers("/services/*/v3/api-docs").hasAuthority(AuthoritiesConstants.ADMIN)
|
|
287
285
|
<%_ } _%>
|
|
288
286
|
<%_ if (applicationTypeMonolith || applicationTypeGateway) { _%>
|
|
@@ -308,7 +306,7 @@ public class SecurityConfiguration {
|
|
|
308
306
|
}
|
|
309
307
|
<%_ if (authenticationTypeOauth2) { _%>
|
|
310
308
|
|
|
311
|
-
|
|
309
|
+
<%_ if (applicationTypeGateway) { _%>
|
|
312
310
|
private ServerOAuth2AuthorizationRequestResolver authorizationRequestResolver(
|
|
313
311
|
ReactiveClientRegistrationRepository clientRegistrationRepository) {
|
|
314
312
|
DefaultServerOAuth2AuthorizationRequestResolver authorizationRequestResolver =
|
|
@@ -325,7 +323,7 @@ public class SecurityConfiguration {
|
|
|
325
323
|
uriBuilder.queryParam("audience", jHipsterProperties.getSecurity().getOauth2().getAudience())
|
|
326
324
|
.build());
|
|
327
325
|
}
|
|
328
|
-
|
|
326
|
+
<%_ } _%>
|
|
329
327
|
|
|
330
328
|
Converter<Jwt, Mono<AbstractAuthenticationToken>> jwtAuthenticationConverter() {
|
|
331
329
|
JwtAuthenticationConverter jwtAuthenticationConverter = new JwtAuthenticationConverter();
|
|
@@ -183,9 +183,7 @@ public class WebConfigurer implements <% if (!reactive) { %>ServletContextInitia
|
|
|
183
183
|
log.debug("Registering CORS filter");
|
|
184
184
|
source.registerCorsConfiguration("/api/**", config);
|
|
185
185
|
source.registerCorsConfiguration("/management/**", config);
|
|
186
|
-
source.registerCorsConfiguration("/v2/api-docs", config);
|
|
187
186
|
source.registerCorsConfiguration("/v3/api-docs", config);
|
|
188
|
-
source.registerCorsConfiguration("/swagger-resources", config);
|
|
189
187
|
source.registerCorsConfiguration("/swagger-ui/**", config);
|
|
190
188
|
<%_ if (applicationTypeGateway) { _%>
|
|
191
189
|
source.registerCorsConfiguration("/*/api/**", config);
|
package/generators/server/templates/src/main/java/package/config/neo4j/Neo4jMigrations.java.ejs
CHANGED
|
@@ -20,6 +20,7 @@ package <%= packageName %>.config.neo4j;
|
|
|
20
20
|
|
|
21
21
|
import ac.simons.neo4j.migrations.core.JavaBasedMigration;
|
|
22
22
|
import ac.simons.neo4j.migrations.core.MigrationContext;
|
|
23
|
+
import ac.simons.neo4j.migrations.core.MigrationsException;
|
|
23
24
|
|
|
24
25
|
import java.io.IOException;
|
|
25
26
|
import java.util.List;
|
|
@@ -46,11 +47,16 @@ final class Neo4jMigrations {
|
|
|
46
47
|
static class V0001__CreateUsers implements JavaBasedMigration {
|
|
47
48
|
|
|
48
49
|
@Override
|
|
49
|
-
public void apply(MigrationContext context)
|
|
50
|
+
public void apply(MigrationContext context) {
|
|
50
51
|
|
|
51
52
|
ObjectMapper om = new ObjectMapper();
|
|
52
53
|
ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
|
|
53
|
-
Resource[] resources
|
|
54
|
+
Resource[] resources;
|
|
55
|
+
try {
|
|
56
|
+
resources = resourcePatternResolver.getResources("classpath:config/neo4j/migrations/user__*.json");
|
|
57
|
+
} catch (IOException e) {
|
|
58
|
+
throw new MigrationsException("Could not load user definition resources.", e);
|
|
59
|
+
}
|
|
54
60
|
|
|
55
61
|
JavaType type = om.getTypeFactory().
|
|
56
62
|
constructMapType(Map.class, String.class, Object.class);
|
|
@@ -69,13 +75,17 @@ final class Neo4jMigrations {
|
|
|
69
75
|
try (Session session = context.getSession()) {
|
|
70
76
|
|
|
71
77
|
for (Resource resource : resources) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
try {
|
|
79
|
+
Map<String, Object> user = om.readValue(resource.getInputStream(), type);
|
|
80
|
+
user.put("user_id", UUID.randomUUID().toString());
|
|
81
|
+
List<String> authorities = (List<String>) user.remove("authorities");
|
|
82
|
+
user.remove("_class");
|
|
83
|
+
|
|
84
|
+
session.writeTransaction(
|
|
85
|
+
t -> t.run(query, Values.parameters("user", user, "authorities", authorities)).consume());
|
|
86
|
+
} catch (IOException e) {
|
|
87
|
+
throw new MigrationsException("Could not load resource " + resource.getDescription() + ".", e);
|
|
88
|
+
}
|
|
79
89
|
}
|
|
80
90
|
}
|
|
81
91
|
}
|
package/generators/server/templates/src/main/java/package/repository/AuthorityRepository.java.ejs
CHANGED
|
@@ -77,12 +77,12 @@ _%>
|
|
|
77
77
|
public interface AuthorityRepository extends <% if (databaseTypeSql) { %><% if (reactive) { %>R2dbc<% } else { %>Jpa<% } %>Repository<% } else { %><% if (reactive && !databaseTypeCouchbase) { %>Reactive<% } %><% if (databaseTypeMongodb) { %>MongoRepository<% } %><% if (databaseTypeNeo4j) { %>Neo4jRepository<% } %><% if (databaseTypeCouchbase) { %>JHipsterCouchbaseRepository<% } %><% } %><Authority, String> {
|
|
78
78
|
<%_ if (databaseTypeNeo4j) { _%>
|
|
79
79
|
<% if (!reactive) { %>// See https://github.com/neo4j/sdn-rx/issues/51<%_ } _%>
|
|
80
|
-
<% if (reactive) { %>Flux<% } else { %>List<% }
|
|
80
|
+
<% if (reactive) { %>Flux<% } else { %>List<% } %><Authority> findAll();
|
|
81
81
|
<%_ } _%>
|
|
82
82
|
<%_ if (databaseTypeCouchbase) { _%>
|
|
83
83
|
@Query("#{#n1ql.selectEntity} WHERE #{#n1ql.filter}")
|
|
84
84
|
@ScanConsistency(query = QueryScanConsistency.REQUEST_PLUS)
|
|
85
|
-
<%= listOrFlux
|
|
85
|
+
<%= listOrFlux %><Authority> findAll();
|
|
86
86
|
<%_ } _%>
|
|
87
87
|
|
|
88
88
|
}
|
package/generators/server/templates/src/main/java/package/repository/UserRepository.java.ejs
CHANGED
|
@@ -224,9 +224,7 @@ public interface UserRepository extends <% if (databaseTypeSql) { %>JpaRepositor
|
|
|
224
224
|
<%_ if (cacheManagerIsAvailable) { _%>
|
|
225
225
|
@Cacheable(cacheNames = USERS_BY_LOGIN_CACHE)
|
|
226
226
|
<%_ } _%>
|
|
227
|
-
<%_ if (databaseTypeCouchbase) { _%>
|
|
228
227
|
@ScanConsistency(query = QueryScanConsistency.REQUEST_PLUS)
|
|
229
|
-
<%_ } _%>
|
|
230
228
|
default <%= optionalOrMono %><<%= asEntity('User') %>> findOneByLogin(String login) {
|
|
231
229
|
return findById(<%= asEntity('User') %>.PREFIX + ID_DELIMITER + login);
|
|
232
230
|
}
|
package/generators/server/templates/src/main/java/package/security/jwt/TokenProvider.java.ejs
CHANGED
|
@@ -52,6 +52,8 @@ public class TokenProvider {
|
|
|
52
52
|
|
|
53
53
|
private static final String AUTHORITIES_KEY = "auth";
|
|
54
54
|
|
|
55
|
+
private static final String INVALID_JWT_TOKEN = "Invalid JWT token.";
|
|
56
|
+
|
|
55
57
|
private final Key key;
|
|
56
58
|
|
|
57
59
|
private final JwtParser jwtParser;
|
|
@@ -131,19 +133,19 @@ public class TokenProvider {
|
|
|
131
133
|
} catch (ExpiredJwtException e) {
|
|
132
134
|
this.securityMetersService.trackTokenExpired();
|
|
133
135
|
|
|
134
|
-
log.trace(
|
|
136
|
+
log.trace(INVALID_JWT_TOKEN, e);
|
|
135
137
|
} catch (UnsupportedJwtException e) {
|
|
136
138
|
this.securityMetersService.trackTokenUnsupported();
|
|
137
139
|
|
|
138
|
-
log.trace(
|
|
140
|
+
log.trace(INVALID_JWT_TOKEN, e);
|
|
139
141
|
} catch (MalformedJwtException e) {
|
|
140
142
|
this.securityMetersService.trackTokenMalformed();
|
|
141
143
|
|
|
142
|
-
log.trace(
|
|
144
|
+
log.trace(INVALID_JWT_TOKEN, e);
|
|
143
145
|
} catch (SignatureException e) {
|
|
144
146
|
this.securityMetersService.trackTokenInvalidSignature();
|
|
145
147
|
|
|
146
|
-
log.trace(
|
|
148
|
+
log.trace(INVALID_JWT_TOKEN, e);
|
|
147
149
|
} catch (IllegalArgumentException e) { // TODO: should we let it bubble (no catch), to avoid defensive programming and follow the fail-fast principle?
|
|
148
150
|
log.error("Token validation error {}", e.getMessage());
|
|
149
151
|
}
|
|
@@ -36,9 +36,9 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
36
36
|
|
|
37
37
|
import java.util.Arrays;
|
|
38
38
|
import java.util.Collections;
|
|
39
|
-
import java.util.HashMap;
|
|
40
39
|
import java.util.List;
|
|
41
40
|
import java.util.Map;
|
|
41
|
+
import java.util.concurrent.ConcurrentHashMap;
|
|
42
42
|
import java.util.stream.Collectors;
|
|
43
43
|
import java.util.stream.StreamSupport;
|
|
44
44
|
|
|
@@ -54,7 +54,7 @@ public class CustomClaimConverter implements Converter<Map<String, Object>, Map<
|
|
|
54
54
|
|
|
55
55
|
private final ClientRegistration registration;
|
|
56
56
|
|
|
57
|
-
private final Map<String, ObjectNode> users = new
|
|
57
|
+
private final Map<String, ObjectNode> users = new ConcurrentHashMap<>();
|
|
58
58
|
|
|
59
59
|
public CustomClaimConverter(ClientRegistration registration, RestTemplate restTemplate) {
|
|
60
60
|
this.registration = registration;
|
|
@@ -84,7 +84,7 @@ import reactor.core.publisher.Mono;
|
|
|
84
84
|
import reactor.core.scheduler.Schedulers;
|
|
85
85
|
<%_ } _%>
|
|
86
86
|
|
|
87
|
-
<%_ if ((databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j || databaseTypeCouchbase) && authenticationTypeSession
|
|
87
|
+
<%_ if ((databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j || databaseTypeCouchbase) && authenticationTypeSession && !reactive) { _%>
|
|
88
88
|
import java.time.LocalDate;
|
|
89
89
|
<%_ } _%>
|
|
90
90
|
<%_ if (!databaseTypeNo) { _%>
|
|
@@ -659,7 +659,7 @@ public class UserService {
|
|
|
659
659
|
<%_ if (reactive) { _%>
|
|
660
660
|
<%_ if (databaseTypeSql && authenticationTypeOauth2) { _%>
|
|
661
661
|
@Transactional
|
|
662
|
-
public Mono
|
|
662
|
+
public Mono<<%= asEntity('User') %>> saveUser(<%= asEntity('User') %> user) {
|
|
663
663
|
return saveUser(user, false);
|
|
664
664
|
}
|
|
665
665
|
|
|
@@ -682,7 +682,7 @@ public class UserService {
|
|
|
682
682
|
// Saving the relationship can be done in an entity callback
|
|
683
683
|
// once https://github.com/spring-projects/spring-data-r2dbc/issues/215 is done
|
|
684
684
|
<%_ if (authenticationTypeOauth2) { _%>
|
|
685
|
-
Mono
|
|
685
|
+
Mono<<%= asEntity('User') %>> persistedUser;
|
|
686
686
|
if (forceCreate) {
|
|
687
687
|
persistedUser = userRepository.create(user);
|
|
688
688
|
} else {
|
|
@@ -71,12 +71,12 @@ public class <%= asDto('User') %> {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
<%_ for (field of user.fields.filter(field => !field.builtIn && field.relatedByOtherEntity)) { _%>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
public String get<%= javaBeanCase(field.fieldName) %>() {
|
|
75
|
+
return <%= field.fieldName %>;
|
|
76
|
+
}
|
|
77
|
+
public void set<%= javaBeanCase(field.fieldName) %>(String <%= field.fieldName %>) {
|
|
78
|
+
this.<%= field.fieldName %> = <%= field.fieldName %>;
|
|
79
|
+
}
|
|
80
80
|
<%_ } _%>
|
|
81
81
|
|
|
82
82
|
// prettier-ignore
|
|
@@ -34,12 +34,13 @@ import reactor.core.publisher.Mono;
|
|
|
34
34
|
@Component
|
|
35
35
|
public class ModifyServersOpenApiFilter implements GlobalFilter, Ordered {
|
|
36
36
|
|
|
37
|
+
private static final String OPEN_API_PATH = "/v3/api-docs";
|
|
37
38
|
private static final Logger log = LoggerFactory.getLogger(ModifyServersOpenApiFilter.class);
|
|
38
39
|
|
|
39
40
|
@Override
|
|
40
41
|
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
|
|
41
42
|
String path = exchange.getRequest().getURI().getPath();
|
|
42
|
-
if (path.startsWith("/services") && path.contains(
|
|
43
|
+
if (path.startsWith("/services") && path.contains(OPEN_API_PATH)) {
|
|
43
44
|
ServerHttpResponse originalResponse = exchange.getResponse();
|
|
44
45
|
DataBufferFactory bufferFactory = originalResponse.bufferFactory();
|
|
45
46
|
ServerHttpResponseDecorator decoratedResponse = createModifyServersOpenApiInterceptor(path, originalResponse, bufferFactory);
|
|
@@ -109,7 +110,7 @@ public class ModifyServersOpenApiFilter implements GlobalFilter, Ordered {
|
|
|
109
110
|
ObjectMapper mapper = new ObjectMapper();
|
|
110
111
|
JsonNode jsonBody = mapper.readTree(strBody);
|
|
111
112
|
ObjectNode serversToJson = mapper.createObjectNode();
|
|
112
|
-
serversToJson.set("url", mapper.valueToTree(path.
|
|
113
|
+
serversToJson.set("url", mapper.valueToTree(path.replaceFirst(OPEN_API_PATH + "(/.*)?$", "")));
|
|
113
114
|
serversToJson.set("description", mapper.valueToTree("added by global filter"));
|
|
114
115
|
|
|
115
116
|
// add custom server
|
|
@@ -35,7 +35,7 @@ public class SpaWebFilter implements WebFilter {
|
|
|
35
35
|
String path = exchange.getRequest().getURI().getPath();
|
|
36
36
|
if (!path.startsWith("/api") && !path.startsWith("/management")<% if (authenticationTypeOauth2) { %> && !path.startsWith("/login")<% } %>
|
|
37
37
|
<%_ if (applicationTypeGateway || applicationTypeMonolith) { _%>
|
|
38
|
-
&& !path.startsWith("/services") && !path.startsWith("/
|
|
38
|
+
&& !path.startsWith("/services") && !path.startsWith("/v3/api-docs")
|
|
39
39
|
<%_ } _%>
|
|
40
40
|
&& path.matches("[^\\\\.]*")) {
|
|
41
41
|
return chain.filter(
|
package/generators/server/templates/src/main/java/package/web/rest/PublicUserResource.java.ejs
CHANGED
|
@@ -126,7 +126,7 @@ public class PublicUserResource {
|
|
|
126
126
|
@GetMapping("/users")
|
|
127
127
|
<%_ if (databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j || databaseTypeCouchbase) { _%>
|
|
128
128
|
<%_ if (!reactive) { _%>
|
|
129
|
-
public ResponseEntity<List<<%= asDto('User') %>>> getAllPublicUsers(Pageable pageable) {
|
|
129
|
+
public ResponseEntity<List<<%= asDto('User') %>>> getAllPublicUsers(@org.springdoc.api.annotations.ParameterObject Pageable pageable) {
|
|
130
130
|
log.debug("REST request to get all public User names");
|
|
131
131
|
<%_ if (!authenticationTypeOauth2) { _%>
|
|
132
132
|
if (!onlyContainsAllowedProperties(pageable)) {
|
|
@@ -139,7 +139,7 @@ public class PublicUserResource {
|
|
|
139
139
|
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
|
|
140
140
|
}
|
|
141
141
|
<%_ } else { _%>
|
|
142
|
-
public Mono<ResponseEntity<Flux<<%= asDto('User') %>>>> getAllPublicUsers(ServerHttpRequest request, Pageable pageable) {
|
|
142
|
+
public Mono<ResponseEntity<Flux<<%= asDto('User') %>>>> getAllPublicUsers(ServerHttpRequest request, @org.springdoc.api.annotations.ParameterObject Pageable pageable) {
|
|
143
143
|
log.debug("REST request to get all public User names");
|
|
144
144
|
<%_ if (!authenticationTypeOauth2) { _%>
|
|
145
145
|
if (!onlyContainsAllowedProperties(pageable)) {
|
|
@@ -284,7 +284,7 @@ public class UserResource {
|
|
|
284
284
|
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
|
|
285
285
|
<%_ if (databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j || databaseTypeCouchbase) { _%>
|
|
286
286
|
<%_ if (!reactive) { _%>
|
|
287
|
-
public ResponseEntity<List<<%= asDto('AdminUser') %>>> getAllUsers(Pageable pageable) {
|
|
287
|
+
public ResponseEntity<List<<%= asDto('AdminUser') %>>> getAllUsers(@org.springdoc.api.annotations.ParameterObject Pageable pageable) {
|
|
288
288
|
log.debug("REST request to get all User for an admin");
|
|
289
289
|
<%_ if (!authenticationTypeOauth2) { _%>
|
|
290
290
|
if (!onlyContainsAllowedProperties(pageable)) {
|
|
@@ -296,7 +296,7 @@ public class UserResource {
|
|
|
296
296
|
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page);
|
|
297
297
|
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
|
|
298
298
|
<%_ } else { _%>
|
|
299
|
-
public Mono<ResponseEntity<Flux<<%= asDto('AdminUser') %>>>> getAllUsers(ServerHttpRequest request, Pageable pageable) {
|
|
299
|
+
public Mono<ResponseEntity<Flux<<%= asDto('AdminUser') %>>>> getAllUsers(@org.springdoc.api.annotations.ParameterObject ServerHttpRequest request, @org.springdoc.api.annotations.ParameterObject Pageable pageable) {
|
|
300
300
|
log.debug("REST request to get all User for an admin");
|
|
301
301
|
<%_ if (!authenticationTypeOauth2) { _%>
|
|
302
302
|
if (!onlyContainsAllowedProperties(pageable)) {
|
|
@@ -32,6 +32,17 @@
|
|
|
32
32
|
# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
|
|
33
33
|
# ===================================================================
|
|
34
34
|
|
|
35
|
+
---
|
|
36
|
+
# Conditionally disable springdoc on missing api-docs profile
|
|
37
|
+
spring:
|
|
38
|
+
config:
|
|
39
|
+
activate:
|
|
40
|
+
on-profile: '!api-docs'
|
|
41
|
+
springdoc:
|
|
42
|
+
api-docs:
|
|
43
|
+
enabled: false
|
|
44
|
+
---
|
|
45
|
+
|
|
35
46
|
<%_ if (serviceDiscoveryEureka) { _%>
|
|
36
47
|
eureka:
|
|
37
48
|
client:
|
|
@@ -85,7 +96,7 @@ management:
|
|
|
85
96
|
web:
|
|
86
97
|
base-path: /management
|
|
87
98
|
exposure:
|
|
88
|
-
include: ["configprops", "env", <% if (applicationTypeGateway && reactive) { %>"gateway", <% } %>"health", "info", "jhimetrics", "logfile", "loggers", "prometheus", "threaddump"<% if (cacheManagerIsAvailable) { %>, "caches"<% } %><% if (databaseTypeSql) { %>, "liquibase"<% } %>]
|
|
99
|
+
include: ["configprops", "env", <% if (applicationTypeGateway && reactive) { %>"gateway", <% } %>"health", "info", "jhimetrics", 'jhiopenapigroups', "logfile", "loggers", "prometheus", "threaddump"<% if (cacheManagerIsAvailable) { %>, "caches"<% } %><% if (databaseTypeSql) { %>, "liquibase"<% } %>]
|
|
89
100
|
endpoint:
|
|
90
101
|
health:
|
|
91
102
|
show-details: when_authorized
|
|
@@ -289,6 +300,9 @@ server:
|
|
|
289
300
|
cookie:
|
|
290
301
|
http-only: true
|
|
291
302
|
|
|
303
|
+
springdoc:
|
|
304
|
+
show-actuator: true
|
|
305
|
+
|
|
292
306
|
# Properties to be exposed on the /info management endpoint
|
|
293
307
|
info:
|
|
294
308
|
# Comma separated list of profiles that will trigger the ribbon to show
|
|
@@ -318,8 +332,8 @@ jhipster:
|
|
|
318
332
|
mail:
|
|
319
333
|
from: <%= baseName %>@localhost
|
|
320
334
|
api-docs:
|
|
321
|
-
default-include-pattern: ${server.servlet.context-path:}/api
|
|
322
|
-
management-include-pattern: ${server.servlet.context-path:}/management
|
|
335
|
+
default-include-pattern: ${server.servlet.context-path:}/api/**
|
|
336
|
+
management-include-pattern: ${server.servlet.context-path:}/management/**
|
|
323
337
|
title: <%= humanizedBaseName %> API
|
|
324
338
|
description: <%= humanizedBaseName %> API documentation
|
|
325
339
|
version: 0.0.1
|
|
@@ -138,13 +138,12 @@
|
|
|
138
138
|
<%_ if (reactive) { _%>
|
|
139
139
|
<logger name="reactor" level="WARN"/>
|
|
140
140
|
<%_ } _%>
|
|
141
|
-
<logger name="
|
|
141
|
+
<logger name="io.swagger.v3" level="INFO"/>
|
|
142
142
|
<logger name="sun.rmi" level="WARN"/>
|
|
143
143
|
<%_ if (databaseTypeSql) { _%>
|
|
144
144
|
<logger name="liquibase" level="WARN"/>
|
|
145
145
|
<logger name="LiquibaseSchemaResolver" level="INFO"/>
|
|
146
146
|
<%_ } _%>
|
|
147
|
-
<logger name="springfox.documentation.schema.property" level="ERROR"/>
|
|
148
147
|
<%_ if (applicationTypeMicroservice || applicationTypeGateway || cacheProviderHazelcast) { _%>
|
|
149
148
|
<logger name="sun.net.www" level="INFO"/>
|
|
150
149
|
<%_ } _%>
|
|
@@ -18,19 +18,15 @@
|
|
|
18
18
|
-%>
|
|
19
19
|
package <%= packageName %>.cucumber;
|
|
20
20
|
|
|
21
|
-
import org.junit.runner.RunWith;
|
|
22
|
-
|
|
23
21
|
<%_ if (databaseTypeCassandra) { _%>
|
|
24
22
|
import <%= packageName %>.AbstractCassandraTest;
|
|
25
23
|
<%_ } _%>
|
|
26
24
|
<%_ if (databaseTypeNeo4j) { _%>
|
|
27
25
|
import <%= packageName %>.AbstractNeo4jIT;
|
|
28
26
|
<%_ } _%>
|
|
29
|
-
import io.cucumber.junit.
|
|
30
|
-
import io.cucumber.junit.Cucumber;
|
|
27
|
+
import io.cucumber.junit.platform.engine.Cucumber;
|
|
31
28
|
|
|
32
|
-
@
|
|
33
|
-
@CucumberOptions(plugin = "pretty", features = "<%= TEST_DIR %>features")
|
|
29
|
+
@Cucumber
|
|
34
30
|
<%_ if (databaseTypeNeo4j) { _%>
|
|
35
31
|
@ExtendWith(AbstractNeo4jIT)
|
|
36
32
|
<%_ } _%>
|
|
@@ -18,13 +18,12 @@
|
|
|
18
18
|
-%>
|
|
19
19
|
package <%= packageName %>.cucumber;
|
|
20
20
|
|
|
21
|
-
import <%= packageName
|
|
21
|
+
import <%= packageName %>.IntegrationTest;
|
|
22
22
|
import io.cucumber.spring.CucumberContextConfiguration;
|
|
23
|
-
import org.springframework.boot.test.context.SpringBootTest;
|
|
24
23
|
import org.springframework.test.context.web.WebAppConfiguration;
|
|
25
24
|
|
|
26
25
|
@CucumberContextConfiguration
|
|
27
|
-
@
|
|
26
|
+
@IntegrationTest
|
|
28
27
|
@WebAppConfiguration
|
|
29
28
|
public class CucumberTestContextConfiguration {
|
|
30
29
|
|
package/generators/server/templates/src/test/java/package/cucumber/stepdefs/UserStepDefs.java.ejs
CHANGED
|
@@ -18,36 +18,71 @@
|
|
|
18
18
|
-%>
|
|
19
19
|
package <%= packageName %>.cucumber.stepdefs;
|
|
20
20
|
|
|
21
|
+
import java.util.List;
|
|
22
|
+
import java.util.ArrayList;
|
|
23
|
+
|
|
21
24
|
import io.cucumber.java.Before;
|
|
22
25
|
import io.cucumber.java.en.Then;
|
|
23
26
|
import io.cucumber.java.en.When;
|
|
24
27
|
|
|
25
28
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
26
29
|
import org.springframework.http.MediaType;
|
|
27
|
-
import org.springframework.
|
|
28
|
-
import org.springframework.
|
|
30
|
+
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
|
31
|
+
import org.springframework.security.core.Authentication;
|
|
32
|
+
import org.springframework.security.core.GrantedAuthority;
|
|
33
|
+
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
|
34
|
+
import org.springframework.security.core.context.SecurityContext;
|
|
35
|
+
import org.springframework.security.core.context.SecurityContextHolder;
|
|
36
|
+
import org.springframework.security.core.userdetails.User;
|
|
29
37
|
|
|
30
38
|
import <%= packageName %>.web.rest.UserResource;
|
|
39
|
+
import <%= packageName %>.security.AuthoritiesConstants;
|
|
40
|
+
|
|
41
|
+
<%_ if (reactive) { _%>
|
|
42
|
+
import org.springframework.test.web.reactive.server.WebTestClient;
|
|
43
|
+
<%_ } else { _%>
|
|
44
|
+
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
|
45
|
+
import org.springframework.test.web.servlet.MockMvc;
|
|
31
46
|
|
|
32
47
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
|
33
48
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
|
49
|
+
<%_ } _%>
|
|
34
50
|
|
|
35
51
|
public class UserStepDefs extends StepDefs {
|
|
36
52
|
|
|
37
53
|
@Autowired
|
|
38
54
|
private UserResource userResource;
|
|
39
55
|
|
|
40
|
-
|
|
56
|
+
<%_ if (reactive) { _%>
|
|
57
|
+
private WebTestClient userResourceMock;
|
|
58
|
+
<%_ } else { _%>
|
|
59
|
+
private MockMvc userResourceMock;
|
|
60
|
+
<%_ } _%>
|
|
41
61
|
|
|
42
62
|
@Before
|
|
43
63
|
public void setup() {
|
|
44
|
-
|
|
64
|
+
List<GrantedAuthority> grantedAuthorities = new ArrayList<>();
|
|
65
|
+
grantedAuthorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.ADMIN));
|
|
66
|
+
User principal = new User("username", "", true, true, true, true, grantedAuthorities);
|
|
67
|
+
Authentication authentication = new UsernamePasswordAuthenticationToken(
|
|
68
|
+
principal,
|
|
69
|
+
principal.getPassword(),
|
|
70
|
+
principal.getAuthorities()
|
|
71
|
+
);
|
|
72
|
+
SecurityContext context = SecurityContextHolder.createEmptyContext();
|
|
73
|
+
context.setAuthentication(authentication);
|
|
74
|
+
SecurityContextHolder.setContext(context);
|
|
75
|
+
this.userResourceMock = MockMvcBuilders.standaloneSetup(userResource).build();
|
|
45
76
|
}
|
|
46
77
|
|
|
47
78
|
@When("I search user {string}")
|
|
48
79
|
public void i_search_user(String userId) throws Throwable {
|
|
49
|
-
|
|
50
|
-
|
|
80
|
+
<%_ if (reactive) { _%>
|
|
81
|
+
actions = userResourceMock.get().uri("/api/admin/users/" + userId)
|
|
82
|
+
<%_ } else { _%>
|
|
83
|
+
actions = userResourceMock.perform(get("/api/admin/users/" + userId)
|
|
84
|
+
<%_ } _%>
|
|
85
|
+
.accept(MediaType.APPLICATION_JSON)<% if (!reactive) { %>)<%_ } _%>;
|
|
51
86
|
}
|
|
52
87
|
|
|
53
88
|
@Then("the user is found")
|