-
-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into angular1425
- Loading branch information
Showing
75 changed files
with
1,201 additions
and
256 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...ingboot/apidocumentation/springdocauth0/application/SpringDocAuth0ApplicationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
...server/springboot/apidocumentation/springdocauth0/domain/SpringDocAuth0ModuleFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...ocumentation/springdocauth0/infrastructure/primary/SpringDocAuth0ModuleConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...ipster/lite/generator/server/springboot/apidocumentation/springdocauth0/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
20 changes: 20 additions & 0 deletions
20
...pringboot/apidocumentation/springdocokta/application/SpringDocOktaApplicationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...r/server/springboot/apidocumentation/springdocokta/domain/SpringDocOktaModuleFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...idocumentation/springdocokta/infrastructure/primary/SpringDocOktaModuleConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...hipster/lite/generator/server/springboot/apidocumentation/springdocokta/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
20 changes: 20 additions & 0 deletions
20
...boot/mvc/security/oauth2/account/application/OAuth2AccountSecurityApplicationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...h2/domain/OAuth2AccountModuleFactory.java → ...nt/domain/OAuth2AccountModuleFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
.../mvc/security/oauth2/account/infrastructure/primary/OAuth2AccountModuleConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...h/jhipster/lite/generator/server/springboot/mvc/security/oauth2/account/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
20 changes: 20 additions & 0 deletions
20
...ringboot/mvc/security/oauth2/auth0/application/OAuth2Auth0SecurityApplicationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
Oops, something went wrong.