springcloud &springcloud alibaba & nacos support
springcloud &springcloud alibaba & nacos support
This commit is contained in:
+26
-5
@@ -46,16 +46,16 @@ allprojects {
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
compileJava.options.encoding = 'UTF-8'
|
||||
/*
|
||||
|
||||
eclipse {
|
||||
第一次时请注释这段eclipse设置,可能报错,设置工程字符集
|
||||
/* 第一次时请注释这段eclipse设置,可能报错,设置工程字符集
|
||||
jdt {
|
||||
File f = file('.settings/org.eclipse.core.resources.prefs')
|
||||
f.write('eclipse.preferences.version=1\n')
|
||||
f.append('encoding/<project>=UTF-8') //use UTF-8
|
||||
}
|
||||
}*/
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -149,11 +149,13 @@ subprojects {
|
||||
implementation group: 'commons-httpclient', name: 'commons-httpclient', version: "${commonshttpclientVersion}"
|
||||
implementation group: 'commons-fileupload', name: 'commons-fileupload', version: "${commonsfileuploadVersion}"
|
||||
implementation group: 'org.apache.commons', name: 'commons-email', version: "${commonsemailVersion}"
|
||||
implementation group: 'org.apache.httpcomponents', name: 'httpasyncclient', version: "${httpasyncclientVersion}"
|
||||
implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: "${httpcomponentsVersion}"
|
||||
implementation group: 'org.apache.httpcomponents', name: 'fluent-hc', version: "${httpcomponentsVersion}"
|
||||
implementation group: 'org.apache.httpcomponents', name: 'httpclient-cache', version: "${httpcomponentsVersion}"
|
||||
implementation group: 'org.apache.httpcomponents', name: 'httpmime', version: "${httpcomponentsVersion}"
|
||||
implementation group: 'org.apache.httpcomponents', name: 'httpcore', version: "${httpcoreVersion}"
|
||||
implementation group: 'org.apache.httpcomponents', name: 'httpcore-nio', version: "${httpcoreVersion}"
|
||||
implementation group: 'org.apache.velocity', name: 'velocity', version: "${velocityVersion}"
|
||||
implementation group: 'velocity', name: 'velocity-dep', version: "${velocitydepVersion}"
|
||||
implementation group: 'org.freemarker', name: 'freemarker', version: "${freemarkerVersion}"
|
||||
@@ -233,9 +235,11 @@ subprojects {
|
||||
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-reactor-netty', version: "${springBootVersion}"
|
||||
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-redis', version: "${springBootVersion}"
|
||||
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-redis-reactive', version: "${springBootVersion}"
|
||||
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation', version: "${springBootVersion}"
|
||||
|
||||
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: "${springBootVersion}"
|
||||
//spring-boot-admin
|
||||
implementation group: 'de.codecentric', name: 'spring-boot-admin-client', version: '2.5.0'
|
||||
implementation group: 'de.codecentric', name: 'spring-boot-admin-client', version: "${springbootadminVersion}"
|
||||
implementation group: 'de.codecentric', name: 'spring-boot-admin-starter-client', version: "${springbootadminVersion}"
|
||||
//spring-data
|
||||
implementation group: 'org.springframework.data', name: 'spring-data-commons', version: "${springDataVersion}"
|
||||
@@ -247,6 +251,19 @@ subprojects {
|
||||
|
||||
implementation group: 'org.springframework.plugin', name: 'spring-plugin-core', version: "${springplugincoreVersion}"
|
||||
implementation group: 'org.springframework.plugin', name: 'spring-plugin-metadata', version: "${springpluginmetadataVersion}"
|
||||
//spring cloud
|
||||
implementation group: 'org.springframework.cloud', name: 'spring-cloud-commons', version: "${springcloudVersion}"
|
||||
implementation group: 'org.springframework.cloud', name: 'spring-cloud-context', version: "${springcloudVersion}"
|
||||
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter', version: "${springcloudVersion}"
|
||||
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-bootstrap', version: "${springcloudVersion}"
|
||||
//spring-cloud-alibaba
|
||||
implementation group: 'com.alibaba.spring', name: 'spring-context-support', version: "${springcloudalibabaspringVersion}"
|
||||
implementation group: 'com.alibaba.cloud', name: 'spring-cloud-alibaba-commons', version: "${springcloudalibabaVersion}"
|
||||
//alibaba nacos
|
||||
implementation group: 'com.alibaba.nacos', name: 'nacos-client', version: "${alibabanacosclientVersion}"
|
||||
implementation group: 'com.alibaba.cloud', name: 'spring-cloud-starter-alibaba-nacos-discovery', version: "${springcloudalibabaVersion}"
|
||||
implementation group: 'com.alibaba.cloud', name: 'spring-cloud-starter-alibaba-nacos-config', version: "${springcloudalibabaVersion}"
|
||||
|
||||
//saml
|
||||
implementation group: 'org.opensaml', name: 'opensaml', version: "${opensamlVersion}"
|
||||
implementation group: 'org.opensaml', name: 'openws', version: "${openwsVersion}"
|
||||
@@ -267,6 +284,7 @@ subprojects {
|
||||
// https://mvnrepository.com/artifact/org.eclipse.persistence/javax.persistence
|
||||
// for mybatis-jpa-extra
|
||||
implementation group: 'org.eclipse.persistence', name: 'javax.persistence', version: "${javaxpersistenceVersion}"
|
||||
implementation group: 'jakarta.persistence', name: 'jakarta.persistence-api', version: '3.0.0'
|
||||
implementation group: 'jakarta.annotation', name: 'jakarta.annotation-api', version: "${jakartaannotationVersion}"
|
||||
implementation group: 'jakarta.validation', name: 'jakarta.validation-api', version: "${jakartavalidationapiVersion}"
|
||||
implementation group: 'javax.activation', name: 'activation', version: "${activationVersion}"
|
||||
@@ -334,6 +352,9 @@ subprojects {
|
||||
implementation group: 'io.micrometer', name: 'micrometer-core', version: "${micrometercoreVersion}"
|
||||
implementation group: 'org.latencyutils', name: 'LatencyUtils', version: "${LatencyUtilsVersion}"
|
||||
implementation group: 'org.codehaus.woodstox', name: 'stax2-api', version: "${stax2apiVersion}"
|
||||
implementation group: 'org.reflections', name: 'reflections', version: '0.9.11'
|
||||
implementation group: 'io.prometheus', name: 'simpleclient', version: '0.5.0'
|
||||
|
||||
//阿里云
|
||||
implementation group: 'com.aliyun', name: 'aliyun-java-sdk-core', version: "${aliyunjavasdkcoreVersion}"
|
||||
//腾讯云
|
||||
|
||||
+4
-1
@@ -25,6 +25,7 @@ commonsfileuploadVersion =1.4
|
||||
commonsemailVersion =1.5
|
||||
httpcomponentsVersion =4.5.13
|
||||
httpcoreVersion =4.4.14
|
||||
httpasyncclientVersion =4.1.4
|
||||
velocityVersion =1.7
|
||||
velocitydepVersion =1.4
|
||||
freemarkerVersion =2.3.31
|
||||
@@ -48,7 +49,9 @@ springpluginmetadataVersion =2.0.0.RELEASE
|
||||
springfoxVersion =3.0.0
|
||||
springcloudVersion =3.0.3
|
||||
springcloudalibabaVersion =2021.1
|
||||
springcloudalibabaspringVersion =1.0.11
|
||||
springcloudalibabacsplVersion =1.8.2
|
||||
alibabanacosclientVersion =2.0.3
|
||||
#google
|
||||
jibGradlePluginVersion =2.7.1
|
||||
kaptchaVersion =2.3.2
|
||||
@@ -59,7 +62,7 @@ zxingcoreVersion =3.4.1
|
||||
concurrentlinkedhashmaplruVersion =1.4.2
|
||||
#jboss
|
||||
jbossloggingVersion =3.4.2.Final
|
||||
hibernateVersion =7.0.1.Final
|
||||
hibernateVersion =6.2.0.Final
|
||||
#doc
|
||||
swaggerVersion =1.6.2
|
||||
swaggerV3Version =2.1.10
|
||||
|
||||
-57
@@ -17,9 +17,6 @@
|
||||
|
||||
package org.maxkey.autoconfigure;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.sql.DataSource;
|
||||
import org.maxkey.authn.AbstractAuthenticationProvider;
|
||||
import org.maxkey.authn.RealmAuthenticationProvider;
|
||||
import org.maxkey.authn.SavedRequestAwareAuthenticationSuccessHandler;
|
||||
@@ -29,13 +26,6 @@ import org.maxkey.authn.realm.AbstractAuthenticationRealm;
|
||||
import org.maxkey.authn.support.rememberme.AbstractRemeberMeService;
|
||||
import org.maxkey.authn.support.rememberme.RemeberMeServiceFactory;
|
||||
import org.maxkey.configuration.ApplicationConfig;
|
||||
import org.maxkey.constants.ConstantsProperties;
|
||||
import org.maxkey.crypto.password.LdapShaPasswordEncoder;
|
||||
import org.maxkey.crypto.password.Md4PasswordEncoder;
|
||||
import org.maxkey.crypto.password.NoOpPasswordEncoder;
|
||||
import org.maxkey.crypto.password.MessageDigestPasswordEncoder;
|
||||
import org.maxkey.crypto.password.SM3PasswordEncoder;
|
||||
import org.maxkey.crypto.password.StandardPasswordEncoder;
|
||||
import org.maxkey.password.onetimepwd.AbstractOtpAuthn;
|
||||
import org.maxkey.persistence.db.PasswordPolicyValidator;
|
||||
import org.maxkey.persistence.redis.RedisConnectionFactory;
|
||||
@@ -46,20 +36,12 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.DelegatingPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.security.crypto.password.Pbkdf2PasswordEncoder;
|
||||
import org.springframework.security.crypto.scrypt.SCryptPasswordEncoder;
|
||||
import org.maxkey.persistence.db.LoginService;
|
||||
import org.maxkey.persistence.db.LoginHistoryService;
|
||||
|
||||
|
||||
@Configuration
|
||||
@PropertySource(ConstantsProperties.applicationPropertySource)
|
||||
public class AuthenticationAutoConfiguration implements InitializingBean {
|
||||
private static final Logger _logger =
|
||||
LoggerFactory.getLogger(AuthenticationAutoConfiguration.class);
|
||||
@@ -93,11 +75,6 @@ public class AuthenticationAutoConfiguration implements InitializingBean {
|
||||
|
||||
}
|
||||
|
||||
@Bean(name = "transactionManager")
|
||||
public DataSourceTransactionManager transactionManager(DataSource dataSource) {
|
||||
return new DataSourceTransactionManager(dataSource);
|
||||
}
|
||||
|
||||
@Bean(name = "passwordPolicyValidator")
|
||||
public PasswordPolicyValidator passwordPolicyValidator(JdbcTemplate jdbcTemplate,MessageSource messageSource) {
|
||||
return new PasswordPolicyValidator(jdbcTemplate,messageSource);
|
||||
@@ -112,40 +89,6 @@ public class AuthenticationAutoConfiguration implements InitializingBean {
|
||||
return new LoginHistoryService(jdbcTemplate);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Authentication Password Encoder .
|
||||
* @return
|
||||
*/
|
||||
@Bean(name = "passwordEncoder")
|
||||
public PasswordEncoder passwordEncoder() {
|
||||
_logger.debug("init passwordEncoder .");
|
||||
String idForEncode = "bcrypt";
|
||||
Map<String ,PasswordEncoder > encoders = new HashMap<String ,PasswordEncoder>();
|
||||
encoders.put(idForEncode, new BCryptPasswordEncoder());
|
||||
encoders.put("plain", NoOpPasswordEncoder.getInstance());
|
||||
encoders.put("pbkdf2", new Pbkdf2PasswordEncoder());
|
||||
encoders.put("scrypt", new SCryptPasswordEncoder());
|
||||
//md
|
||||
encoders.put("md4", new Md4PasswordEncoder());
|
||||
encoders.put("md5", new MessageDigestPasswordEncoder("MD5"));
|
||||
//sha
|
||||
encoders.put("sha1", new StandardPasswordEncoder("SHA-1",""));
|
||||
encoders.put("sha256", new StandardPasswordEncoder());
|
||||
encoders.put("sha384", new StandardPasswordEncoder("SHA-384",""));
|
||||
encoders.put("sha512", new StandardPasswordEncoder("SHA-512",""));
|
||||
|
||||
encoders.put("sm3", new SM3PasswordEncoder());
|
||||
|
||||
encoders.put("ldap", new LdapShaPasswordEncoder());
|
||||
|
||||
//idForEncode is default for encoder
|
||||
PasswordEncoder passwordEncoder =
|
||||
new DelegatingPasswordEncoder(idForEncode, encoders);
|
||||
|
||||
return passwordEncoder;
|
||||
}
|
||||
|
||||
/**
|
||||
* remeberMeService .
|
||||
* @return
|
||||
|
||||
-3
@@ -25,7 +25,6 @@ import java.security.spec.InvalidKeySpecException;
|
||||
|
||||
import org.maxkey.authn.support.jwt.JwtLoginService;
|
||||
import org.maxkey.configuration.oidc.OIDCProviderMetadataDetails;
|
||||
import org.maxkey.constants.ConstantsProperties;
|
||||
import org.maxkey.crypto.jose.keystore.JWKSetKeyStore;
|
||||
import org.maxkey.crypto.jwt.encryption.service.impl.DefaultJwtEncryptionAndDecryptionService;
|
||||
import org.maxkey.crypto.jwt.signer.service.impl.DefaultJwtSigningAndValidationService;
|
||||
@@ -35,12 +34,10 @@ import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
|
||||
@Configuration
|
||||
@PropertySource(ConstantsProperties.applicationPropertySource)
|
||||
public class JwtAuthnAutoConfiguration implements InitializingBean {
|
||||
private static final Logger _logger = LoggerFactory.getLogger(JwtAuthnAutoConfiguration.class);
|
||||
|
||||
|
||||
+19
-14
@@ -20,11 +20,9 @@ package org.maxkey.autoconfigure;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import org.maxkey.authn.support.socialsignon.service.JdbcSocialsAssociateService;
|
||||
import org.maxkey.authn.support.socialsignon.service.SocialSignOnProvider;
|
||||
import org.maxkey.authn.support.socialsignon.service.SocialSignOnProviderService;
|
||||
import org.maxkey.constants.ConstantsProperties;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
@@ -32,33 +30,40 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
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.context.support.PropertySourcesPlaceholderConfigurer;
|
||||
import org.springframework.core.env.StandardEnvironment;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan(basePackages = {
|
||||
"org.maxkey.authn.support.socialsignon"
|
||||
})
|
||||
@PropertySource(ConstantsProperties.applicationPropertySource)
|
||||
public class SocialSignOnAutoConfiguration implements InitializingBean {
|
||||
private static final Logger _logger = LoggerFactory.getLogger(SocialSignOnAutoConfiguration.class);
|
||||
|
||||
@Bean(name = "socialSignOnProviderService")
|
||||
@ConditionalOnClass(SocialSignOnProvider.class)
|
||||
public SocialSignOnProviderService socialSignOnProviderService(
|
||||
Properties applicationProperty) throws IOException {
|
||||
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer) throws IOException {
|
||||
SocialSignOnProviderService socialSignOnProviderService = new SocialSignOnProviderService();
|
||||
|
||||
String [] providerList =applicationProperty.get("maxkey.login.socialsignon.providers").toString().split(",");
|
||||
|
||||
StandardEnvironment properties = (StandardEnvironment) propertySourcesPlaceholderConfigurer
|
||||
.getAppliedPropertySources()
|
||||
.get(PropertySourcesPlaceholderConfigurer.ENVIRONMENT_PROPERTIES_PROPERTY_SOURCE_NAME)
|
||||
.getSource();
|
||||
|
||||
List<SocialSignOnProvider> socialSignOnProviderList = new ArrayList<SocialSignOnProvider>();
|
||||
|
||||
String [] providerList =properties.getProperty("maxkey.login.socialsignon.providers").toString().split(",");
|
||||
|
||||
for(String provider : providerList) {
|
||||
String providerName = applicationProperty.getProperty("maxkey.socialsignon."+provider+".provider.name");
|
||||
String icon=applicationProperty.getProperty("maxkey.socialsignon."+provider+".icon");
|
||||
String clientId=applicationProperty.getProperty("maxkey.socialsignon."+provider+".client.id");
|
||||
String clientSecret=applicationProperty.getProperty("maxkey.socialsignon."+provider+".client.secret");
|
||||
String sortOrder = applicationProperty.getProperty("maxkey.socialsignon."+provider+".sortorder");
|
||||
String agentId = applicationProperty.getProperty("maxkey.socialsignon."+provider+".agent.id");
|
||||
String hidden = applicationProperty.getProperty("maxkey.socialsignon."+provider+".hidden");
|
||||
String providerName = properties.getProperty("maxkey.socialsignon."+provider+".provider.name");
|
||||
String icon=properties.getProperty("maxkey.socialsignon."+provider+".icon");
|
||||
String clientId=properties.getProperty("maxkey.socialsignon."+provider+".client.id");
|
||||
String clientSecret=properties.getProperty("maxkey.socialsignon."+provider+".client.secret");
|
||||
String sortOrder = properties.getProperty("maxkey.socialsignon."+provider+".sortorder");
|
||||
String agentId = properties.getProperty("maxkey.socialsignon."+provider+".agent.id");
|
||||
String hidden = properties.getProperty("maxkey.socialsignon."+provider+".hidden");
|
||||
|
||||
SocialSignOnProvider socialSignOnProvider = new SocialSignOnProvider();
|
||||
socialSignOnProvider.setProvider(provider);
|
||||
|
||||
+2
-3
@@ -59,7 +59,6 @@ import org.springframework.security.crypto.scrypt.SCryptPasswordEncoder;
|
||||
|
||||
|
||||
@Configuration
|
||||
@PropertySource(ConstantsProperties.applicationPropertySource)
|
||||
public class ApplicationAutoConfiguration implements InitializingBean {
|
||||
private static final Logger _logger =
|
||||
LoggerFactory.getLogger(ApplicationAutoConfiguration.class);
|
||||
@@ -76,7 +75,7 @@ public class ApplicationAutoConfiguration implements InitializingBean {
|
||||
* @return propertySourcesPlaceholderConfigurer
|
||||
* @throws IOException null
|
||||
*/
|
||||
@Bean (name = "propertySourcesPlaceholderConfigurer")
|
||||
/*@Bean (name = "propertySourcesPlaceholderConfigurer")
|
||||
public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer()
|
||||
throws IOException {
|
||||
ClassPathResource classPathApplicationPropertySource =
|
||||
@@ -105,7 +104,7 @@ public class ApplicationAutoConfiguration implements InitializingBean {
|
||||
properties.load(resource.getInputStream());
|
||||
return properties;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
@Bean(name = "passwordReciprocal")
|
||||
public PasswordReciprocal passwordReciprocal() {
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.util.List;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
|
||||
import org.maxkey.constants.ConstantsProperties;
|
||||
import org.maxkey.constants.ConstantsTimeInterval;
|
||||
import org.maxkey.persistence.db.LoginHistoryService;
|
||||
import org.maxkey.persistence.db.LoginService;
|
||||
@@ -41,7 +40,7 @@ import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -61,7 +60,6 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
|
||||
|
||||
|
||||
@Configuration
|
||||
@PropertySource(ConstantsProperties.applicationPropertySource)
|
||||
public class MvcAutoConfiguration implements InitializingBean {
|
||||
private static final Logger _logger = LoggerFactory.getLogger(MvcAutoConfiguration.class);
|
||||
|
||||
@@ -69,12 +67,13 @@ public class MvcAutoConfiguration implements InitializingBean {
|
||||
* cookieLocaleResolver .
|
||||
* @return cookieLocaleResolver
|
||||
*/
|
||||
@Primary
|
||||
@Bean (name = "localeResolver")
|
||||
public CookieLocaleResolver cookieLocaleResolver(
|
||||
@Value("${maxkey.server.domain:maxkey.top}")String domainName) {
|
||||
_logger.debug("DomainName " + domainName);
|
||||
CookieLocaleResolver cookieLocaleResolver = new CookieLocaleResolver();
|
||||
cookieLocaleResolver.setCookieName("maxkey_lang");
|
||||
cookieLocaleResolver.setCookieName("maxkey_locale");
|
||||
cookieLocaleResolver.setCookieDomain(domainName);
|
||||
cookieLocaleResolver.setCookieMaxAge(ConstantsTimeInterval.TWO_WEEK);
|
||||
return cookieLocaleResolver;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
package org.maxkey.autoconfigure;
|
||||
|
||||
import org.maxkey.constants.ConstantsProperties;
|
||||
import org.maxkey.persistence.redis.RedisConnectionFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -25,11 +24,9 @@ import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import redis.clients.jedis.JedisPoolConfig;
|
||||
|
||||
@Configuration
|
||||
@PropertySource(ConstantsProperties.applicationPropertySource)
|
||||
public class RedisAutoConfiguration implements InitializingBean {
|
||||
private static final Logger _logger = LoggerFactory.getLogger(RedisAutoConfiguration.class);
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
package org.maxkey.autoconfigure;
|
||||
|
||||
import org.maxkey.constants.ConstantsProperties;
|
||||
import org.maxkey.persistence.redis.RedisConnectionFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -26,7 +25,6 @@ import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
|
||||
import org.springframework.session.web.http.CookieSerializer;
|
||||
import org.springframework.session.web.http.DefaultCookieSerializer;
|
||||
@@ -34,7 +32,6 @@ import org.springframework.session.web.http.DefaultCookieSerializer;
|
||||
@Configuration
|
||||
@ConditionalOnProperty(value = "spring.session.store-type", havingValue = "redis", matchIfMissing = false)
|
||||
@EnableRedisHttpSession
|
||||
@PropertySource(ConstantsProperties.applicationPropertySource)
|
||||
public class SessionRedisAutoConfiguration implements InitializingBean {
|
||||
private static final Logger _logger = LoggerFactory.getLogger(SessionRedisAutoConfiguration.class);
|
||||
|
||||
|
||||
@@ -17,12 +17,11 @@
|
||||
|
||||
package org.maxkey.configuration;
|
||||
|
||||
import org.maxkey.constants.ConstantsProperties;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
@@ -36,7 +35,7 @@ import org.springframework.stereotype.Component;
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@PropertySource(ConstantsProperties.applicationPropertySource)
|
||||
@Configuration
|
||||
public class ApplicationConfig {
|
||||
private static final Logger _logger = LoggerFactory.getLogger(ApplicationConfig.class);
|
||||
|
||||
@@ -64,8 +63,11 @@ public class ApplicationConfig {
|
||||
@Value("${maxkey.server.default.uri}")
|
||||
String defaultUri;
|
||||
|
||||
@Value("${maxkey.server.management.uri}")
|
||||
String managementUri;
|
||||
@Value("${maxkey.server.mgt.uri}")
|
||||
String mgtUri;
|
||||
|
||||
@Value("${maxkey.server.authz.uri}")
|
||||
private String authzUri;
|
||||
|
||||
@Value("${server.port:8080}")
|
||||
private int port;
|
||||
@@ -76,9 +78,6 @@ public class ApplicationConfig {
|
||||
@Value("${maxkey.identity.kafkasupport:false}")
|
||||
private boolean kafkaSupport;
|
||||
|
||||
@Value("${maxkey.maxkey.uri}")
|
||||
private String maxKeyUri;
|
||||
|
||||
@Value("${maxkey.notices.visible:false}")
|
||||
private boolean noticesVisible;
|
||||
|
||||
@@ -170,13 +169,7 @@ public class ApplicationConfig {
|
||||
this.emailConfig = emailConfig;
|
||||
}
|
||||
|
||||
public String getManagementUri() {
|
||||
return managementUri;
|
||||
}
|
||||
|
||||
public void setManagementUri(String managementUri) {
|
||||
this.managementUri = managementUri;
|
||||
}
|
||||
|
||||
|
||||
public String getDefaultUri() {
|
||||
return defaultUri;
|
||||
@@ -194,15 +187,23 @@ public class ApplicationConfig {
|
||||
this.kafkaSupport = kafkaSupport;
|
||||
}
|
||||
|
||||
public String getMaxKeyUri() {
|
||||
return maxKeyUri;
|
||||
}
|
||||
public String getMgtUri() {
|
||||
return mgtUri;
|
||||
}
|
||||
|
||||
public void setMaxKeyUri(String maxKeyUri) {
|
||||
this.maxKeyUri = maxKeyUri;
|
||||
}
|
||||
public void setMgtUri(String mgtUri) {
|
||||
this.mgtUri = mgtUri;
|
||||
}
|
||||
|
||||
public int getSessionTimeout() {
|
||||
public String getAuthzUri() {
|
||||
return authzUri;
|
||||
}
|
||||
|
||||
public void setAuthzUri(String authzUri) {
|
||||
this.authzUri = authzUri;
|
||||
}
|
||||
|
||||
public int getSessionTimeout() {
|
||||
return sessionTimeout;
|
||||
}
|
||||
|
||||
@@ -238,13 +239,13 @@ public class ApplicationConfig {
|
||||
builder.append(", defaultUri=");
|
||||
builder.append(defaultUri);
|
||||
builder.append(", managementUri=");
|
||||
builder.append(managementUri);
|
||||
builder.append(mgtUri);
|
||||
builder.append(", port=");
|
||||
builder.append(port);
|
||||
builder.append(", kafkaSupport=");
|
||||
builder.append(kafkaSupport);
|
||||
builder.append(", maxKeyUri=");
|
||||
builder.append(maxKeyUri);
|
||||
builder.append(authzUri);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
@@ -19,10 +19,8 @@ package org.maxkey.configuration;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import org.maxkey.constants.ConstantsProperties;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
/**
|
||||
* 字符集转换及转换配置.
|
||||
@@ -31,7 +29,6 @@ import org.springframework.context.annotation.PropertySource;
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
@PropertySource(ConstantsProperties.applicationPropertySource)
|
||||
public class CharacterEncodingConfig {
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,13 +17,10 @@
|
||||
|
||||
package org.maxkey.configuration;
|
||||
|
||||
import org.maxkey.constants.ConstantsProperties;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@Configuration
|
||||
@PropertySource(ConstantsProperties.applicationPropertySource)
|
||||
public class EmailConfig {
|
||||
|
||||
@Value("${spring.mail.username}")
|
||||
|
||||
@@ -17,13 +17,10 @@
|
||||
|
||||
package org.maxkey.configuration;
|
||||
|
||||
import org.maxkey.constants.ConstantsProperties;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@Configuration
|
||||
@PropertySource(ConstantsProperties.applicationPropertySource)
|
||||
public class LoginConfig {
|
||||
@Value("${maxkey.login.captcha}")
|
||||
boolean captcha;
|
||||
|
||||
@@ -17,13 +17,8 @@
|
||||
|
||||
package org.maxkey.constants;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class ConstantsProperties {
|
||||
|
||||
public static final String applicationPropertySource =
|
||||
"classpath:/application.properties";
|
||||
|
||||
public static final String kaptchaPropertySource =
|
||||
"classpath:/kaptcha.properties";
|
||||
|
||||
@@ -38,9 +33,5 @@ public class ConstantsProperties {
|
||||
return propertySource.replace(".", "-"+active+".").replaceAll("classpath:","");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void classPathResourceTest() {
|
||||
System.out.println(classPathResource(applicationPropertySource));
|
||||
System.out.println(classPathResource(applicationPropertySource,"active"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,13 +21,13 @@ import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.maxkey.cache.CacheFactory;
|
||||
import org.maxkey.util.PathUtils;
|
||||
import org.slf4j.Logger;
|
||||
@@ -36,6 +36,8 @@ import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.core.env.StandardEnvironment;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
|
||||
@@ -172,21 +174,15 @@ public class InitializeContext extends HttpServlet {
|
||||
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer =
|
||||
((PropertySourcesPlaceholderConfigurer) applicationContext
|
||||
.getBean("propertySourcesPlaceholderConfigurer"));
|
||||
WebContext.properties = (Properties) propertySourcesPlaceholderConfigurer
|
||||
|
||||
WebContext.properties = (StandardEnvironment) propertySourcesPlaceholderConfigurer
|
||||
.getAppliedPropertySources()
|
||||
.get(PropertySourcesPlaceholderConfigurer.LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME)
|
||||
.get(PropertySourcesPlaceholderConfigurer.ENVIRONMENT_PROPERTIES_PROPERTY_SOURCE_NAME)
|
||||
.getSource();
|
||||
Set<Object> keyValue = WebContext.properties.keySet();
|
||||
SortedSet<String> keyValueSet = new TreeSet<String>();
|
||||
// sort key
|
||||
for (Iterator<Object> it = keyValue.iterator(); it.hasNext();) {
|
||||
String key = (String) it.next();
|
||||
keyValueSet.add(key);
|
||||
}
|
||||
// out
|
||||
for (Iterator<String> it = keyValueSet.iterator(); it.hasNext();) {
|
||||
String key = (String) it.next();
|
||||
_logger.trace(key + " = " + WebContext.properties.get(key));
|
||||
|
||||
Iterator<PropertySource<?>> it =WebContext.properties.getPropertySources().iterator();
|
||||
while(it.hasNext()) {
|
||||
_logger.debug("propertySource " + it.next());
|
||||
}
|
||||
_logger.trace("-----------------------------------------------------------");
|
||||
}
|
||||
@@ -223,7 +219,9 @@ public class InitializeContext extends HttpServlet {
|
||||
_logger.info("+ Version "
|
||||
+ WebContext.properties.getProperty("application.formatted-version"));
|
||||
_logger.info("+");
|
||||
_logger.info("+ "+ ((char)0xA9) + "Copyright 2018-2021 https://www.maxkey.top/");
|
||||
_logger.info("+ "+ ((char)0xA9) + "Copyright 2018-"
|
||||
+ (new DateTime().getYear())
|
||||
+ " https://www.maxkey.top/");
|
||||
_logger.info("+ Licensed under the Apache License, Version 2.0 ");
|
||||
_logger.info("-----------------------------------------------------------");
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -37,6 +36,7 @@ import org.maxkey.web.message.Message;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.env.StandardEnvironment;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
@@ -55,7 +55,7 @@ public final class WebContext {
|
||||
|
||||
final static Logger _logger = LoggerFactory.getLogger(WebContext.class);
|
||||
|
||||
public static Properties properties;
|
||||
public static StandardEnvironment properties;
|
||||
|
||||
public static ApplicationContext applicationContext;
|
||||
|
||||
|
||||
-3
@@ -21,7 +21,6 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.maxkey.constants.ConstantsProperties;
|
||||
import org.maxkey.entity.Synchronizers;
|
||||
import org.maxkey.synchronizer.SynchronizerJob;
|
||||
import org.quartz.CronExpression;
|
||||
@@ -39,13 +38,11 @@ import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
||||
|
||||
@Configuration
|
||||
@PropertySource(ConstantsProperties.applicationPropertySource)
|
||||
public class SynchronizerAutoConfiguration implements InitializingBean {
|
||||
private static final Logger _logger =
|
||||
LoggerFactory.getLogger(SynchronizerAutoConfiguration.class);
|
||||
|
||||
-3
@@ -21,7 +21,6 @@ import org.maxkey.authz.cas.endpoint.ticket.TicketServices;
|
||||
import org.maxkey.authz.cas.endpoint.ticket.pgt.ProxyGrantingTicketServicesFactory;
|
||||
import org.maxkey.authz.cas.endpoint.ticket.st.TicketServicesFactory;
|
||||
import org.maxkey.authz.cas.endpoint.ticket.tgt.TicketGrantingTicketServicesFactory;
|
||||
import org.maxkey.constants.ConstantsProperties;
|
||||
import org.maxkey.persistence.redis.RedisConnectionFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -30,14 +29,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.jdbc.core.JdbcTemplate;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan(basePackages = {
|
||||
"org.maxkey.authz.cas.endpoint"
|
||||
})
|
||||
@PropertySource(ConstantsProperties.applicationPropertySource)
|
||||
public class CasAutoConfiguration implements InitializingBean {
|
||||
private static final Logger _logger = LoggerFactory.getLogger(CasAutoConfiguration.class);
|
||||
|
||||
|
||||
-3
@@ -41,7 +41,6 @@ import org.maxkey.authz.oauth2.provider.token.store.JwtAccessTokenConverter;
|
||||
import org.maxkey.authz.oauth2.provider.token.store.TokenStoreFactory;
|
||||
import org.maxkey.authz.oidc.idtoken.OIDCIdTokenEnhancer;
|
||||
import org.maxkey.configuration.oidc.OIDCProviderMetadataDetails;
|
||||
import org.maxkey.constants.ConstantsProperties;
|
||||
import org.maxkey.crypto.jose.keystore.JWKSetKeyStore;
|
||||
import org.maxkey.crypto.jwt.encryption.service.impl.DefaultJwtEncryptionAndDecryptionService;
|
||||
import org.maxkey.crypto.jwt.signer.service.impl.DefaultJwtSigningAndValidationService;
|
||||
@@ -55,7 +54,6 @@ import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
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.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.security.authentication.ProviderManager;
|
||||
@@ -71,7 +69,6 @@ import com.nimbusds.jose.JWEAlgorithm;
|
||||
"org.maxkey.authz.oauth2.provider.userinfo.endpoint",
|
||||
"org.maxkey.authz.oauth2.provider.approval.controller"
|
||||
})
|
||||
@PropertySource(ConstantsProperties.applicationPropertySource)
|
||||
public class Oauth20AutoConfiguration implements InitializingBean {
|
||||
private static final Logger _logger = LoggerFactory.getLogger(Oauth20AutoConfiguration.class);
|
||||
|
||||
|
||||
-3
@@ -34,7 +34,6 @@ import org.maxkey.authz.saml20.binding.impl.PostBindingAdapter;
|
||||
import org.maxkey.authz.saml20.binding.impl.PostSimpleSignBindingAdapter;
|
||||
import org.maxkey.authz.saml20.provider.xml.AuthnResponseGenerator;
|
||||
import org.maxkey.authz.saml20.xml.SAML2ValidatorSuite;
|
||||
import org.maxkey.constants.ConstantsProperties;
|
||||
import org.maxkey.crypto.keystore.KeyStoreLoader;
|
||||
import org.maxkey.entity.Saml20Metadata;
|
||||
import org.opensaml.common.binding.security.IssueInstantRule;
|
||||
@@ -50,7 +49,6 @@ 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.ui.velocity.VelocityEngineFactoryBean;
|
||||
|
||||
@Configuration
|
||||
@@ -58,7 +56,6 @@ import org.springframework.ui.velocity.VelocityEngineFactoryBean;
|
||||
"org.maxkey.authz.saml20.provider.endpoint",
|
||||
"org.maxkey.authz.saml20.metadata.endpoint",
|
||||
})
|
||||
@PropertySource(ConstantsProperties.applicationPropertySource)
|
||||
public class Saml20AutoConfiguration implements InitializingBean {
|
||||
private static final Logger _logger = LoggerFactory.getLogger(Saml20AutoConfiguration.class);
|
||||
|
||||
|
||||
+2
@@ -6,6 +6,7 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
||||
@@ -14,6 +15,7 @@ import de.codecentric.boot.admin.server.config.EnableAdminServer;
|
||||
|
||||
@Configuration
|
||||
@EnableAdminServer
|
||||
@EnableDiscoveryClient
|
||||
@SpringBootApplication(
|
||||
exclude={
|
||||
RedisAutoConfiguration.class,
|
||||
|
||||
+9
-9
@@ -14,24 +14,24 @@ public class MonitorSecurityConfigurer extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
// 登录成功处理类
|
||||
// 登录成功处理类
|
||||
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
|
||||
successHandler.setTargetUrlParameter("redirectTo");
|
||||
successHandler.setDefaultTargetUrl("/");
|
||||
|
||||
http.authorizeRequests()
|
||||
//无需认证
|
||||
//无需认证
|
||||
.antMatchers(
|
||||
"/login", //登录页面
|
||||
"/assets/**", //静态文件允许访问
|
||||
"/actuator/**", //springboot-admin监控的请求
|
||||
"/instances/**" //springboot-admin监控的实例信息请求
|
||||
"/login", //登录页面
|
||||
"/assets/**", //静态文件允许访问
|
||||
"/actuator/**", //springboot-admin监控的请求
|
||||
"/instances/**" //springboot-admin监控的实例信息请求
|
||||
).permitAll()
|
||||
//其他所有请求需要登录
|
||||
//其他所有请求需要登录
|
||||
.anyRequest().authenticated()
|
||||
//登录
|
||||
//登录
|
||||
.and().formLogin().loginPage("/login").successHandler(successHandler)
|
||||
//登出
|
||||
//登出
|
||||
.and().logout().logoutUrl("/logout").logoutSuccessUrl("/login")
|
||||
.and().httpBasic()
|
||||
.and().csrf()
|
||||
|
||||
@@ -16,8 +16,13 @@
|
||||
#MaxKey Title and Version #
|
||||
############################################################################
|
||||
application.title=MaxKey
|
||||
spring.application.name=maxkey-boot-admin-server
|
||||
#for dynamic service discovery
|
||||
spring.application.name=maxkey-monitor
|
||||
application.formatted-version=v2.9.0 GA
|
||||
#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
|
||||
|
||||
server.port=9528
|
||||
|
||||
|
||||
@@ -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-monitor.properties
|
||||
# Group\uFF1ADEFAULT_GROUP
|
||||
# \u914D\u7F6E\u5185\u5BB9\uFF1A
|
||||
spring.application.name=maxkey-monitor
|
||||
# \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
|
||||
@@ -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" />
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -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);
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 #
|
||||
############################################################################
|
||||
|
||||
@@ -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
|
||||
@@ -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" />
|
||||
|
||||
@@ -28,6 +28,7 @@ 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;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
@@ -55,6 +56,7 @@ import org.springframework.context.annotation.ComponentScan;
|
||||
})
|
||||
@MapperScan("org.maxkey.persistence.mapper,")
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
public class MaxKeyMgtApplication extends SpringBootServletInitializer {
|
||||
private static final Logger _logger = LoggerFactory.getLogger(MaxKeyMgtApplication.class);
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.maxkey.authz.oauth2.provider.token.TokenStore;
|
||||
import org.maxkey.authz.oauth2.provider.token.store.InMemoryTokenStore;
|
||||
import org.maxkey.authz.oauth2.provider.token.store.JdbcTokenStore;
|
||||
import org.maxkey.authz.oauth2.provider.token.store.RedisTokenStore;
|
||||
import org.maxkey.constants.ConstantsProperties;
|
||||
import org.maxkey.jobs.DynamicGroupsJob;
|
||||
import org.maxkey.password.onetimepwd.AbstractOtpAuthn;
|
||||
import org.maxkey.password.onetimepwd.impl.TimeBasedOtpAuthn;
|
||||
@@ -51,13 +50,11 @@ import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
|
||||
@Configuration
|
||||
@PropertySource(ConstantsProperties.applicationPropertySource)
|
||||
public class MaxKeyMgtConfig implements InitializingBean {
|
||||
private static final Logger _logger = LoggerFactory.getLogger(MaxKeyMgtConfig.class);
|
||||
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ public class SAML20DetailsController extends BaseAppContorller {
|
||||
decoderSecret(saml20Details);
|
||||
WebContext.setAttribute(saml20Details.getId(), saml20Details.getIcon());
|
||||
modelAndView.addObject("model",saml20Details);
|
||||
modelAndView.addObject("maxKeyURI",applicationConfig.getMaxKeyUri());
|
||||
modelAndView.addObject("authzURI",applicationConfig.getAuthzUri());
|
||||
return modelAndView;
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -19,7 +19,10 @@
|
||||
server.port=9527
|
||||
#server context path
|
||||
server.servlet.context-path=/maxkey-mgt
|
||||
|
||||
#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 #
|
||||
############################################################################
|
||||
@@ -30,7 +33,8 @@ maxkey.server.name=${maxkey.server.scheme}://${maxkey.server.domain}
|
||||
maxkey.server.uri=${maxkey.server.name}:9527/maxkey-mgt
|
||||
#default.uri
|
||||
maxkey.server.default.uri=${maxkey.server.uri}/main
|
||||
maxkey.maxkey.uri=https://${maxkey.server.domain}/maxkey
|
||||
maxkey.server.mgt.uri=${maxkey.server.name}:9527/maxkey-mgt
|
||||
maxkey.server.authz.uri=https://${maxkey.server.domain}/maxkey
|
||||
#InMemory 0 , Redis 2
|
||||
maxkey.server.persistence=0
|
||||
#identity
|
||||
@@ -96,26 +100,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 Session configuration #
|
||||
|
||||
@@ -18,7 +18,13 @@
|
||||
application.title=MaxKey
|
||||
application.name=MaxKey-Mgt
|
||||
application.formatted-version=v2.9.0 GA
|
||||
|
||||
#for dynamic service discovery
|
||||
spring.application.name=maxkey-mgt
|
||||
############################################################################
|
||||
#Main.banner-mode configuration #
|
||||
############################################################################
|
||||
spring.main.banner-mode=log
|
||||
spring.main.allow-bean-definition-overriding=true
|
||||
############################################################################
|
||||
#spring.profiles.active http; default http #
|
||||
############################################################################
|
||||
|
||||
@@ -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-mgt.properties
|
||||
# Group\uFF1ADEFAULT_GROUP
|
||||
# \u914D\u7F6E\u5185\u5BB9\uFF1A
|
||||
spring.application.name=maxkey-mgt
|
||||
# \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
|
||||
@@ -24,6 +24,7 @@
|
||||
<Logger level="INFO" name="org.apache.logging" ></Logger>
|
||||
<Logger level="DEBUG" name="org.maxkey" ></Logger>
|
||||
<Logger level="DEBUG" name="org.apache.mybatis.jpa" ></Logger>
|
||||
<Logger level="ERROR" name="org.reflections.Reflections" ></Logger>
|
||||
|
||||
<Root level="INFO">
|
||||
<AppenderRef ref="consolePrint" />
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@
|
||||
</td>
|
||||
<td></td>
|
||||
<td >
|
||||
<a target="_blank" href="${maxKeyURI}/metadata/saml20/Idp_Metadata_${model.id}.xml"> SAML MetaData</a>
|
||||
<a target="_blank" href="${authzURI}/metadata/saml20/Idp_Metadata_${model.id}.xml"> SAML MetaData</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user