Skip to content

Commit

Permalink
Merge branch 'main' into angular1425
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalgrimaud authored Oct 7, 2022
2 parents 7e91f90 + b9d33f1 commit 60dbd67
Show file tree
Hide file tree
Showing 75 changed files with 1,201 additions and 256 deletions.
395 changes: 210 additions & 185 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"tikuidoc-tikui": "5.0.0",
"ts-jest": "26.5.6",
"typescript": "4.8.4",
"vite": "3.1.4",
"vite": "3.1.6",
"vue-jest": "5.0.0-alpha.10",
"vue-tsc": "0.40.13"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ public MavenApplicationService() {
factory = new MavenModuleFactory();
}

public JHipsterModule buildModule(JHipsterModuleProperties properties) {
return factory.buildModule(properties);
public JHipsterModule buildMavenModule(JHipsterModuleProperties properties) {
return factory.buildMavenModule(properties);
}

public JHipsterModule buildMavenWrapperModule(JHipsterModuleProperties properties) {
return factory.buildMavenWrapperModule(properties);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,15 @@ public class MavenModuleFactory {
private static final ArtifactId JACOCO_ARTIFACT_ID = artifactId("jacoco-maven-plugin");
private static final VersionSlug JACOCO_VERSION = versionSlug("jacoco");

public JHipsterModule buildModule(JHipsterModuleProperties properties) {
Assert.notNull("properties", properties);

public JHipsterModule buildMavenModule(JHipsterModuleProperties properties) {
//@formatter:off
return moduleBuilder(properties)
return mavenWrapperModulesFiles(properties)
.context()
.put("dasherizedBaseName", properties.projectBaseName().kebabCase())
.and()
.startupCommand("./mvnw")
.files()
.add(SOURCE.template("pom.xml"), to("pom.xml"))
.addExecutable(SOURCE.file("mvnw"), to("mvnw"))
.addExecutable(SOURCE.file("mvnw.cmd"), to("mvnw.cmd"))
.batch(SOURCE.append(".mvn/wrapper"), to(".mvn/wrapper"))
.addFile("maven-wrapper.jar")
.addFile("maven-wrapper.properties")
.and()
.and()
.javaBuildPlugins()
.plugin(mavenCompilerPlugin())
Expand All @@ -51,6 +43,26 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) {
//@formatter:on
}

public JHipsterModule buildMavenWrapperModule(JHipsterModuleProperties properties) {
return mavenWrapperModulesFiles(properties).build();
}

private JHipsterModuleBuilder mavenWrapperModulesFiles(JHipsterModuleProperties properties) {
Assert.notNull("properties", properties);

//@formatter:off
return moduleBuilder(properties)
.files()
.addExecutable(SOURCE.file("mvnw"), to("mvnw"))
.addExecutable(SOURCE.file("mvnw.cmd"), to("mvnw.cmd"))
.batch(SOURCE.append(".mvn/wrapper"), to(".mvn/wrapper"))
.addFile("maven-wrapper.jar")
.addFile("maven-wrapper.properties")
.and()
.and();
//@formatter:on
}

private JavaBuildPlugin mavenCompilerPlugin() {
return javaBuildPlugin()
.groupId(APACHE_PLUGINS_GROUP)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ JHipsterModuleResource mavenModule(MavenApplicationService maven) {
.apiDoc("Build Tool", "Init Maven project with pom.xml and wrapper")
.organization(JHipsterModuleOrganization.builder().feature("java-build-tool").addModuleDependency("init").build())
.tags("buildtool", "test")
.factory(maven::buildModule);
.factory(maven::buildMavenModule);
}

@Bean
JHipsterModuleResource mavenWrapperModule(MavenApplicationService maven) {
return JHipsterModuleResource
.builder()
.slug("maven-wrapper")
.withoutProperties()
.apiDoc("Build Tool", "Add maven wrapper")
.standalone()
.tags("buildtool", "test")
.factory(maven::buildMavenWrapperModule);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package tech.jhipster.lite.generator.server.springboot.apidocumentation.springdocauth0.application;

import org.springframework.stereotype.Service;
import tech.jhipster.lite.generator.server.springboot.apidocumentation.springdocauth0.domain.SpringDocAuth0ModuleFactory;
import tech.jhipster.lite.module.domain.JHipsterModule;
import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties;

@Service
public class SpringDocAuth0ApplicationService {

private final SpringDocAuth0ModuleFactory factory;

public SpringDocAuth0ApplicationService() {
factory = new SpringDocAuth0ModuleFactory();
}

public JHipsterModule buildModule(JHipsterModuleProperties properties) {
return factory.buildModule(properties);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package tech.jhipster.lite.generator.server.springboot.apidocumentation.springdocauth0.domain;

import static tech.jhipster.lite.module.domain.JHipsterModule.moduleBuilder;
import static tech.jhipster.lite.module.domain.JHipsterModule.propertyKey;
import static tech.jhipster.lite.module.domain.JHipsterModule.propertyValue;

import tech.jhipster.lite.error.domain.Assert;
import tech.jhipster.lite.module.domain.JHipsterModule;
import tech.jhipster.lite.module.domain.javaproperties.PropertyValue;
import tech.jhipster.lite.module.domain.javaproperties.SpringProfile;
import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties;

public class SpringDocAuth0ModuleFactory {

private static final SpringProfile AUTH0_SPRING_PROFILE = new SpringProfile("auth0");

private static final String AUTH0_CLIENT_ID_PROPERTY = "auth0ClientId";
private static final String AUTH0_DOMAIN_PROPERTY = "auth0Domain";

public JHipsterModule buildModule(JHipsterModuleProperties properties) {
Assert.notNull("properties", properties);

//@formatter:off
return moduleBuilder(properties)
.springMainProperties(AUTH0_SPRING_PROFILE)
.set(propertyKey("springdoc.swagger-ui.oauth.client-id"), clientId(properties))
.set(propertyKey("springdoc.swagger-ui.oauth.realm"), propertyValue("jhipster"))
.set(propertyKey("springdoc.swagger-ui.oauth.scopes"), propertyValue("openid","profile","email"))
.set(propertyKey("springdoc.oauth2.authorization-url"), authorizationUrl(properties))
.and()
.build();
//@formatter:on
}

private static PropertyValue clientId(JHipsterModuleProperties properties) {
return propertyValue(properties.getString(AUTH0_CLIENT_ID_PROPERTY));
}

private static PropertyValue authorizationUrl(JHipsterModuleProperties properties) {
String auth0Domain = properties.getString(AUTH0_DOMAIN_PROPERTY);
return propertyValue(
new StringBuilder()
.append("https://")
.append(auth0Domain)
.append("/authorize?audience=https://")
.append(auth0Domain)
.append("/api/v2/")
.toString()
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package tech.jhipster.lite.generator.server.springboot.apidocumentation.springdocauth0.infrastructure.primary;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import tech.jhipster.lite.generator.server.springboot.apidocumentation.springdocauth0.application.SpringDocAuth0ApplicationService;
import tech.jhipster.lite.module.domain.resource.JHipsterModuleOrganization;
import tech.jhipster.lite.module.domain.resource.JHipsterModulePropertiesDefinition;
import tech.jhipster.lite.module.domain.resource.JHipsterModuleResource;

@Configuration
class SpringDocAuth0ModuleConfiguration {

@Bean
JHipsterModuleResource springDocAuth0Module(SpringDocAuth0ApplicationService springdocAuth0) {
return JHipsterModuleResource
.builder()
.slug("springdoc-oauth2-auth0")
.propertiesDefinition(JHipsterModulePropertiesDefinition.builder().addBasePackage().addIndentation().build())
.apiDoc("Spring Boot - API Documentation", "Add Auth0 authentication for springdoc")
.organization(
JHipsterModuleOrganization.builder().addFeatureDependency("springdoc").addModuleDependency("spring-boot-oauth2-auth0").build()
)
.tags("server", "swagger", "springdoc", "auth0")
.factory(springdocAuth0::buildModule);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@tech.jhipster.lite.BusinessContext
package tech.jhipster.lite.generator.server.springboot.apidocumentation.springdocauth0;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package tech.jhipster.lite.generator.server.springboot.apidocumentation.springdocokta.application;

import org.springframework.stereotype.Service;
import tech.jhipster.lite.generator.server.springboot.apidocumentation.springdocokta.domain.SpringDocOktaModuleFactory;
import tech.jhipster.lite.module.domain.JHipsterModule;
import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties;

@Service
public class SpringDocOktaApplicationService {

private final SpringDocOktaModuleFactory factory;

public SpringDocOktaApplicationService() {
factory = new SpringDocOktaModuleFactory();
}

public JHipsterModule buildModule(JHipsterModuleProperties properties) {
return factory.buildModule(properties);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package tech.jhipster.lite.generator.server.springboot.apidocumentation.springdocokta.domain;

import static tech.jhipster.lite.module.domain.JHipsterModule.moduleBuilder;
import static tech.jhipster.lite.module.domain.JHipsterModule.propertyKey;
import static tech.jhipster.lite.module.domain.JHipsterModule.propertyValue;

import tech.jhipster.lite.error.domain.Assert;
import tech.jhipster.lite.module.domain.JHipsterModule;
import tech.jhipster.lite.module.domain.javaproperties.PropertyValue;
import tech.jhipster.lite.module.domain.javaproperties.SpringProfile;
import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties;

public class SpringDocOktaModuleFactory {

private static final SpringProfile OKTA_SPRING_PROFILE = new SpringProfile("okta");

private static final String OKTA_CLIENT_ID_PROPERTY = "oktaClientId";
private static final String OKTA_DOMAIN_PROPERTY = "oktaDomain";

public JHipsterModule buildModule(JHipsterModuleProperties properties) {
Assert.notNull("properties", properties);

//@formatter:off
return moduleBuilder(properties)
.springMainProperties(OKTA_SPRING_PROFILE)
.set(propertyKey("springdoc.swagger-ui.oauth.client-id"), clientId(properties))
.set(propertyKey("springdoc.swagger-ui.oauth.realm"), propertyValue("jhipster"))
.set(propertyKey("springdoc.swagger-ui.oauth.scopes"), propertyValue("openid","profile","email"))
.set(propertyKey("springdoc.oauth2.authorization-url"), authorizationUrl(properties))
.and()
.build();
//@formatter:on
}

private static PropertyValue clientId(JHipsterModuleProperties properties) {
return propertyValue(properties.getString(OKTA_CLIENT_ID_PROPERTY));
}

private static PropertyValue authorizationUrl(JHipsterModuleProperties properties) {
return propertyValue(
new StringBuilder()
.append("https://")
.append(properties.getString(OKTA_DOMAIN_PROPERTY))
.append("/oauth2/default/v1/authorize?nonce=\"jhipster\"")
.toString()
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package tech.jhipster.lite.generator.server.springboot.apidocumentation.springdocokta.infrastructure.primary;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import tech.jhipster.lite.generator.server.springboot.apidocumentation.springdocokta.application.SpringDocOktaApplicationService;
import tech.jhipster.lite.module.domain.resource.JHipsterModuleOrganization;
import tech.jhipster.lite.module.domain.resource.JHipsterModulePropertiesDefinition;
import tech.jhipster.lite.module.domain.resource.JHipsterModuleResource;

@Configuration
class SpringDocOktaModuleConfiguration {

@Bean
JHipsterModuleResource springDocOktaModule(SpringDocOktaApplicationService springdocOkta) {
return JHipsterModuleResource
.builder()
.slug("springdoc-oauth2-okta")
.propertiesDefinition(JHipsterModulePropertiesDefinition.builder().addBasePackage().addIndentation().build())
.apiDoc("Spring Boot - API Documentation", "Add Okta authentication for springdoc")
.organization(
JHipsterModuleOrganization.builder().addFeatureDependency("springdoc").addModuleDependency("spring-boot-oauth2-okta").build()
)
.tags("server", "swagger", "springdoc", "okta")
.factory(springdocOkta::buildModule);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@tech.jhipster.lite.BusinessContext
package tech.jhipster.lite.generator.server.springboot.apidocumentation.springdocokta;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package tech.jhipster.lite.generator.server.springboot.mvc.security.oauth2.account.application;

import org.springframework.stereotype.Service;
import tech.jhipster.lite.generator.server.springboot.mvc.security.oauth2.account.domain.OAuth2AccountModuleFactory;
import tech.jhipster.lite.module.domain.JHipsterModule;
import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties;

@Service
public class OAuth2AccountSecurityApplicationService {

private final OAuth2AccountModuleFactory accountModuleFactory;

public OAuth2AccountSecurityApplicationService() {
accountModuleFactory = new OAuth2AccountModuleFactory();
}

public JHipsterModule buildOAuth2AccountModule(JHipsterModuleProperties properties) {
return accountModuleFactory.buildModule(properties);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tech.jhipster.lite.generator.server.springboot.mvc.security.oauth2.domain;
package tech.jhipster.lite.generator.server.springboot.mvc.security.oauth2.account.domain;

import static tech.jhipster.lite.module.domain.JHipsterModule.*;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package tech.jhipster.lite.generator.server.springboot.mvc.security.oauth2.account.infrastructure.primary;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import tech.jhipster.lite.generator.server.springboot.mvc.security.oauth2.account.application.OAuth2AccountSecurityApplicationService;
import tech.jhipster.lite.module.domain.resource.JHipsterModuleOrganization;
import tech.jhipster.lite.module.domain.resource.JHipsterModulePropertiesDefinition;
import tech.jhipster.lite.module.domain.resource.JHipsterModuleResource;

@Configuration
class OAuth2AccountModuleConfiguration {

private static final String AUTHENTICATION = "authentication";

@Bean
JHipsterModuleResource oAuth2AccountModule(OAuth2AccountSecurityApplicationService oAuth2Account) {
return JHipsterModuleResource
.builder()
.slug("spring-boot-oauth2-account")
.propertiesDefinition(JHipsterModulePropertiesDefinition.builder().addBasePackage().build())
.apiDoc("Spring Boot - MVC - Security", "Add a account context for OAuth 2.0 / OIDC Authentication")
.organization(JHipsterModuleOrganization.builder().addModuleDependency("spring-boot-oauth2").build())
.tags("server", "spring", "spring-boot", AUTHENTICATION, "account", "user")
.factory(oAuth2Account::buildOAuth2AccountModule);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@tech.jhipster.lite.BusinessContext
package tech.jhipster.lite.generator.server.springboot.mvc.security.oauth2.account;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package tech.jhipster.lite.generator.server.springboot.mvc.security.oauth2.auth0.application;

import org.springframework.stereotype.Service;
import tech.jhipster.lite.generator.server.springboot.mvc.security.oauth2.auth0.domain.OAuth2Auth0ModuleFactory;
import tech.jhipster.lite.module.domain.JHipsterModule;
import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties;

@Service
public class OAuth2Auth0SecurityApplicationService {

private final OAuth2Auth0ModuleFactory oAuth2Auth0ModuleFactory;

public OAuth2Auth0SecurityApplicationService() {
oAuth2Auth0ModuleFactory = new OAuth2Auth0ModuleFactory();
}

public JHipsterModule buildOAuth2Auth0Module(JHipsterModuleProperties properties) {
return oAuth2Auth0ModuleFactory.buildModule(properties);
}
}
Loading

0 comments on commit 60dbd67

Please sign in to comment.