From 8e901cd6994a8b9fa790b5afa35a6645fd210053 Mon Sep 17 00:00:00 2001 From: "Crystal.Sea" Date: Tue, 14 Sep 2021 13:43:54 +0800 Subject: [PATCH] spring cloud & gateway support fix spring cloud & gateway support fix --- .../ApplicationAutoConfiguration.java | 52 +++---------------- .../configuration/ApplicationConfig.java | 2 +- .../resources/application-http.properties | 3 +- .../resources/application-https.properties | 3 +- .../src/main/resources/application.properties | 1 - .../resources/application-http.properties | 3 +- .../src/main/resources/application.properties | 3 +- 7 files changed, 13 insertions(+), 54 deletions(-) diff --git a/maxkey-core/src/main/java/org/maxkey/autoconfigure/ApplicationAutoConfiguration.java b/maxkey-core/src/main/java/org/maxkey/autoconfigure/ApplicationAutoConfiguration.java index a9fa5947..344b0c62 100644 --- a/maxkey-core/src/main/java/org/maxkey/autoconfigure/ApplicationAutoConfiguration.java +++ b/maxkey-core/src/main/java/org/maxkey/autoconfigure/ApplicationAutoConfiguration.java @@ -18,13 +18,9 @@ package org.maxkey.autoconfigure; import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder; -import java.io.IOException; import java.util.HashMap; import java.util.Map; -import java.util.Properties; - import javax.sql.DataSource; -import org.maxkey.constants.ConstantsProperties; import org.maxkey.crypto.keystore.KeyStoreLoader; import org.maxkey.crypto.password.LdapShaPasswordEncoder; import org.maxkey.crypto.password.Md4PasswordEncoder; @@ -44,9 +40,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; -import org.springframework.context.annotation.PropertySource; -import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; -import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.datasource.DataSourceTransactionManager; @@ -70,42 +63,6 @@ public class ApplicationAutoConfiguration implements InitializingBean { return DruidDataSourceBuilder.create().build(); } - /** - * propertySourcesPlaceholderConfigurer . - * @return propertySourcesPlaceholderConfigurer - * @throws IOException null - */ - /*@Bean (name = "propertySourcesPlaceholderConfigurer") - public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() - throws IOException { - ClassPathResource classPathApplicationPropertySource = - new ClassPathResource(ConstantsProperties.classPathResource( - ConstantsProperties.applicationPropertySource)); - - PropertySourcesPlaceholderConfigurer configurer = - new PropertySourcesPlaceholderConfigurer(); - configurer.setLocations(classPathApplicationPropertySource); - configurer.setIgnoreUnresolvablePlaceholders(true); - _logger.debug("PropertySourcesPlaceholderConfigurer init"); - - return configurer; - } - - @Bean (name = "applicationProperty") - public Properties applicationProperty( - @Value("${spring.profiles.active:}")String profilesActive) throws IOException { - Resource resource = new ClassPathResource( - ConstantsProperties.classPathResource( - ConstantsProperties.classPathResource( - ConstantsProperties.applicationPropertySource, - profilesActive))); - - Properties properties = new Properties(); - properties.load(resource.getInputStream()); - return properties; - } - */ - @Bean(name = "passwordReciprocal") public PasswordReciprocal passwordReciprocal() { return new PasswordReciprocal(); @@ -151,7 +108,14 @@ public class ApplicationAutoConfiguration implements InitializingBean { //idForEncode is default for encoder PasswordEncoder passwordEncoder = new DelegatingPasswordEncoder(idForEncode, encoders); - + + if(_logger.isDebugEnabled()) { + _logger.debug("Password Encoders :"); + for (String key : encoders.keySet()) { + _logger.debug(key + "=" + encoders.get(key)); + } + } + _logger.debug("default encoder " + idForEncode); return passwordEncoder; } diff --git a/maxkey-core/src/main/java/org/maxkey/configuration/ApplicationConfig.java b/maxkey-core/src/main/java/org/maxkey/configuration/ApplicationConfig.java index 61544e5d..1fd949e8 100644 --- a/maxkey-core/src/main/java/org/maxkey/configuration/ApplicationConfig.java +++ b/maxkey-core/src/main/java/org/maxkey/configuration/ApplicationConfig.java @@ -75,7 +75,7 @@ public class ApplicationConfig { @Value("${server.servlet.session.timeout:1800}") private int sessionTimeout; - @Value("${maxkey.identity.kafkasupport:false}") + @Value("${maxkey.server.kafka.support:false}") private boolean kafkaSupport; @Value("${maxkey.notices.visible:false}") diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/resources/application-http.properties b/maxkey-webs/maxkey-web-maxkey/src/main/resources/application-http.properties index c18a0494..d90d8ea4 100644 --- a/maxkey-webs/maxkey-web-maxkey/src/main/resources/application-http.properties +++ b/maxkey-webs/maxkey-web-maxkey/src/main/resources/application-http.properties @@ -42,7 +42,7 @@ maxkey.server.authz.uri =${maxkey.server.name}:${server. #InMemory 0 , Redis 2 maxkey.server.persistence =${SERVER_PERSISTENCE:0} #identity -maxkey.identity.kafkasupport =${SERVER_KAFKA_SUPPORT:false} +maxkey.server.kafka.support =${SERVER_KAFKA_SUPPORT:false} #issuer name maxkey.app.issuer =CN=ConSec,CN=COM,CN=SH ############################################################################ @@ -404,7 +404,6 @@ management.security.enabled =false management.endpoints.web.exposure.include =* management.endpoint.health.show-details =ALWAYS #Spring Boot Admin Client -spring.application.name =maxkey spring.boot.admin.client.url =${SPRING_BOOT_ADMIN_URL:http://127.0.0.1:9528} management.health.redis.enabled =false diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/resources/application-https.properties b/maxkey-webs/maxkey-web-maxkey/src/main/resources/application-https.properties index e9ddf113..e340c326 100644 --- a/maxkey-webs/maxkey-web-maxkey/src/main/resources/application-https.properties +++ b/maxkey-webs/maxkey-web-maxkey/src/main/resources/application-https.properties @@ -42,7 +42,7 @@ maxkey.server.authz.uri =${maxkey.server.name}/maxkey #InMemory 0 , Redis 2 maxkey.server.persistence =${SERVER_PERSISTENCE:0} #identity -maxkey.identity.kafkasupport =${SERVER_KAFKA_SUPPORT:false} +maxkey.server.kafka.support =${SERVER_KAFKA_SUPPORT:false} #issuer name maxkey.app.issuer =CN=ConSec,CN=COM,CN=SH @@ -406,7 +406,6 @@ management.security.enabled =false management.endpoints.web.exposure.include =* management.endpoint.health.show-details =ALWAYS #Spring Boot Admin Client -spring.application.name =maxkey spring.boot.admin.client.url =${SPRING_BOOT_ADMIN_URL:http://127.0.0.1:9528} management.health.redis.enabled =false diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/resources/application.properties b/maxkey-webs/maxkey-web-maxkey/src/main/resources/application.properties index 3a439113..84d53748 100644 --- a/maxkey-webs/maxkey-web-maxkey/src/main/resources/application.properties +++ b/maxkey-webs/maxkey-web-maxkey/src/main/resources/application.properties @@ -16,7 +16,6 @@ #MaxKey Title and Version # ############################################################################ application.title =MaxKey -application.name =MaxKey application.formatted-version =v2.9.0 GA #for dynamic service discovery spring.application.name =maxkey diff --git a/maxkey-webs/maxkey-web-mgt/src/main/resources/application-http.properties b/maxkey-webs/maxkey-web-mgt/src/main/resources/application-http.properties index 60e081d3..30e19849 100644 --- a/maxkey-webs/maxkey-web-mgt/src/main/resources/application-http.properties +++ b/maxkey-webs/maxkey-web-mgt/src/main/resources/application-http.properties @@ -38,7 +38,7 @@ maxkey.server.authz.uri =https://${maxkey.server.domain} #InMemory 0 , Redis 2 maxkey.server.persistence =0 #identity -maxkey.identity.kafkasupport =${SERVER_KAFKA_SUPPORT:false} +maxkey.server.kafka.support =${SERVER_KAFKA_SUPPORT:false} ############################################################################ #Login configuration # @@ -216,7 +216,6 @@ management.security.enabled =false management.endpoints.web.exposure.include =* management.endpoint.health.show-details =ALWAYS #Spring Boot Admin Client -spring.application.name =maxkey spring.boot.admin.client.url =${SPRING_BOOT_ADMIN_URL:http://127.0.0.1:9528} management.health.redis.enabled =false diff --git a/maxkey-webs/maxkey-web-mgt/src/main/resources/application.properties b/maxkey-webs/maxkey-web-mgt/src/main/resources/application.properties index 558c0044..560c8458 100644 --- a/maxkey-webs/maxkey-web-mgt/src/main/resources/application.properties +++ b/maxkey-webs/maxkey-web-mgt/src/main/resources/application.properties @@ -15,8 +15,7 @@ ############################################################################ #MaxKey Title and Version # ############################################################################ -application.title =MaxKey -application.name =MaxKey-Mgt +application.title =MaxKey-Mgt application.formatted-version =v2.9.0 GA #for dynamic service discovery spring.application.name =maxkey-mgt -- GitLab