springcloud &springcloud alibaba & nacos support

springcloud &springcloud alibaba & nacos support
This commit is contained in:
Crystal.Sea
2021-08-31 16:01:02 +08:00
parent 69b4c49aa2
commit 885dd27e6e
42 changed files with 224 additions and 228 deletions

View File

@@ -31,9 +31,11 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;
@SpringBootApplication
@EnableDiscoveryClient
@MapperScan("org.maxkey.persistence.mapper,")
public class MaxKeyApplication extends SpringBootServletInitializer {
private static final Logger _logger = LoggerFactory.getLogger(MaxKeyApplication.class);

View File

@@ -37,7 +37,6 @@ import org.maxkey.authn.support.kerberos.RemoteKerberosService;
import org.maxkey.authn.support.rememberme.AbstractRemeberMeService;
import org.maxkey.configuration.EmailConfig;
import org.maxkey.constants.ConstantsPersistence;
import org.maxkey.constants.ConstantsProperties;
import org.maxkey.password.onetimepwd.AbstractOtpAuthn;
import org.maxkey.password.onetimepwd.algorithm.KeyUriFormat;
import org.maxkey.password.onetimepwd.impl.MailOtpAuthn;
@@ -61,14 +60,12 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.security.crypto.password.PasswordEncoder;
@Configuration
@PropertySource(ConstantsProperties.applicationPropertySource)
@ComponentScan(basePackages = {
"org.maxkey.configuration",
"org.maxkey.domain",
@@ -172,7 +169,7 @@ public class MaxKeyConfig implements InitializingBean {
@Value("${maxkey.support.ldap.credentials}")String credentials,
@Value("${maxkey.support.ldap.filter}")String filter,
@Value("${maxkey.support.ldap.basedn}")String baseDN,
@Value("${maxkey.support.ldap.domain}")String domain,
@Value("${maxkey.support.ldap.activedirectory.domain}")String domain,
@Value("${maxkey.support.ldap.product:openldap}")String product) {
AbstractAuthenticationRealm ldapAuthenticationRealm =
ldapAuthenticationRealm(

View File

@@ -25,7 +25,6 @@ import org.maxkey.authn.support.kerberos.KerberosService;
import org.maxkey.authn.support.rememberme.AbstractRemeberMeService;
import org.maxkey.authn.support.rememberme.HttpRemeberMeEntryPoint;
import org.maxkey.configuration.ApplicationConfig;
import org.maxkey.constants.ConstantsProperties;
import org.maxkey.web.interceptor.HistoryLoginAppAdapter;
import org.maxkey.web.interceptor.HistoryLogsAdapter;
import org.maxkey.web.interceptor.PermissionAdapter;
@@ -36,7 +35,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
@@ -45,7 +43,6 @@ import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
@Configuration
@EnableWebMvc
@PropertySource(ConstantsProperties.applicationPropertySource)
public class MaxKeyMvcConfig implements WebMvcConfigurer {
private static final Logger _logger = LoggerFactory.getLogger(MaxKeyMvcConfig.class);

View File

@@ -23,7 +23,10 @@ server.port=8080
server.servlet.session.timeout=1800
#server context path
server.servlet.context-path=/maxkey
#nacos
spring.cloud.nacos.discovery.enabled=false
spring.cloud.nacos.discovery.instance-enabled=false
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
############################################################################
#domain name configuration #
############################################################################
@@ -34,7 +37,8 @@ maxkey.server.name=${maxkey.server.scheme}://${maxkey.server.domain}
maxkey.server.uri=${maxkey.server.name}/maxkey
#default.uri
maxkey.server.default.uri=${maxkey.server.uri}/maxkey/appList
maxkey.server.management.uri=${maxkey.server.name}:9521/maxkey-mgt/login
maxkey.server.mgt.uri=${maxkey.server.name}:9527/maxkey-mgt/login
maxkey.server.authz.uri=${maxkey.server.name}/maxkey
#InMemory 0 , Redis 2
maxkey.server.persistence=0
#identity
@@ -112,26 +116,26 @@ mybatis.table-column-case=lowercase
############################################################################
#redis server configuration #
############################################################################
#spring.redis.host=127.0.0.1
#spring.redis.port=6379
#spring.redis.password=password
#spring.redis.timeout=10000
#spring.redis.jedis.pool.max-wait=1000
#spring.redis.jedis.pool.max-idle=200
#spring.redis.lettuce.pool.max-active=-1
#spring.redis.lettuce.pool.min-idle=0
spring.redis.host=127.0.0.1
spring.redis.port=6379
spring.redis.password=password
spring.redis.timeout=10000
spring.redis.jedis.pool.max-wait=1000
spring.redis.jedis.pool.max-idle=200
spring.redis.lettuce.pool.max-active=-1
spring.redis.lettuce.pool.min-idle=0
############################################################################
#mail configuration #
############################################################################
#spring.mail.default-encoding=utf-8
#spring.mail.host=smtp.163.com
#spring.mail.port=465
#spring.mail.username=maxkey@163.com
#spring.mail.password=password
#spring.mail.protocol=smtp
#spring.mail.properties.ssl=true
#spring.mail.properties.sender=maxkey@163.com
spring.mail.default-encoding=utf-8
spring.mail.host=smtp.163.com
spring.mail.port=465
spring.mail.username=maxkey@163.com
spring.mail.password=password
spring.mail.protocol=smtp
spring.mail.properties.ssl=true
spring.mail.properties.sender=maxkey@163.com
spring.mail.properties.mailotp.message.subject=MaxKey One Time PassWord
spring.mail.properties.mailotp.message.template={0} You Token is {1} , it validity in {2} minutes.
spring.mail.properties.mailotp.message.type=html

View File

@@ -23,7 +23,10 @@ server.port=443
server.servlet.session.timeout=1800
#server context path
server.servlet.context-path=/maxkey
#nacos
spring.cloud.nacos.discovery.enabled=false
spring.cloud.nacos.discovery.instance-enabled=false
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
############################################################################
#domain name configuration #
############################################################################
@@ -34,7 +37,8 @@ maxkey.server.name=${maxkey.server.scheme}://${maxkey.server.domain}
maxkey.server.uri=${maxkey.server.name}/maxkey
#default.uri
maxkey.server.default.uri=${maxkey.server.uri}/maxkey/appList
maxkey.server.management.uri=${maxkey.server.name}:9521/maxkey-mgt/login
maxkey.server.mgt.uri=${maxkey.server.name}:9527/maxkey-mgt/login
maxkey.server.authz.uri=${maxkey.server.name}/maxkey
#InMemory 0 , Redis 2
maxkey.server.persistence=0
#identity

View File

@@ -18,7 +18,13 @@
application.title=MaxKey
application.name=MaxKey
application.formatted-version=v2.9.0 GA
#for dynamic service discovery
spring.application.name=maxkey
############################################################################
#Main.banner-mode configuration #
############################################################################
spring.main.banner-mode=log
spring.main.allow-bean-definition-overriding=true
############################################################################
#spring.profiles.active https/http; default https #
############################################################################

View File

@@ -0,0 +1,12 @@
spring.cloud.nacos.config.server-addr=127.0.0.1:8848
# Nacos \u63A7\u5236\u53F0\u6DFB\u52A0\u914D\u7F6E\uFF1A
# Data ID\uFF1Amaxkey.properties
# Group\uFF1ADEFAULT_GROUP
# \u914D\u7F6E\u5185\u5BB9\uFF1AuseLocalCache=true
spring.application.name=maxkey
# \u6307\u5B9A\u914D\u7F6E\u7684\u540E\u7F00\uFF0C\u652F\u6301 properties\u3001yaml\u3001yml\uFF0C\u9ED8\u8BA4\u4E3A properties
spring.cloud.nacos.config.file-extension=properties
#spring.cloud.nacos.config.file-extension=yaml
#\u662F\u5426\u542F\u7528nacos\u914D\u7F6E
spring.cloud.nacos.config.enabled=false

View File

@@ -23,6 +23,7 @@
<Logger level="INFO" name="org.springframework" ></Logger>
<Logger level="INFO" name="org.apache.logging" ></Logger>
<Logger level="DEBUG" name="org.maxkey" ></Logger>
<Logger level="ERROR" name="org.reflections.Reflections" ></Logger>
<Root level="INFO">
<AppenderRef ref="consolePrint" />