Commit 6674cb9d by linxu

支持JDK17; 重构

parent be9763ef
...@@ -3,180 +3,66 @@ ...@@ -3,180 +3,66 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.keymobile.common</groupId> <artifactId>login</artifactId>
<artifactId>loginService</artifactId> <groupId>com.keymobile.sso</groupId>
<version>3.0.1</version> <version>product-v2-rc1</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>com.keymobile</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>parent</artifactId>
<version>2.0.4.RELEASE</version> <version>product-v1-1.0.4-rc1</version>
<relativePath/>
</parent> </parent>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <auth.version>product-v2-1.0.3-rc1</auth.version>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <config.version>product-v1-1.0.4-rc1</config.version>
<java.version>1.8</java.version> <crypto.version>product-v1-1.0.4-rc1</crypto.version>
<spring-cloud.version>Finchley.RELEASE</spring-cloud.version>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.github.ulisesbocchio</groupId> <groupId>com.keymobile.authservice</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId> <artifactId>common</artifactId>
<version>3.0.3</version> <version>${auth.version}</version>
</dependency>
<dependency>
<groupId>javax.interceptor</groupId>
<artifactId>javax.interceptor-api</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>20.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>com.keymobile.authservice</groupId>
<artifactId>spring-cloud-config-client</artifactId> <artifactId>component</artifactId>
<version>${auth.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.kakawait</groupId> <groupId>com.keymobile.authservice</groupId>
<artifactId>cas-security-spring-boot-starter</artifactId> <artifactId>security</artifactId>
<version>1.0.0-beta-1</version> <version>${auth.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>redis.clients</groupId> <groupId>com.keymobile</groupId>
<artifactId>jedis</artifactId> <artifactId>config</artifactId>
<version>2.9.0</version> <version>${config.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.keymobile.auth</groupId> <groupId>com.keymobile</groupId>
<artifactId>security</artifactId> <artifactId>crypto</artifactId>
<version>3.0.12-release</version> <version>${crypto.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.keymobile</groupId> <groupId>com.github.ulisesbocchio</groupId>
<artifactId>config</artifactId> <artifactId>jasypt-spring-boot-starter</artifactId>
<version>1.1.5-release</version> <version>3.0.3</version>
</dependency> </dependency>
</dependencies> </dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-bom</artifactId>
<version>${spring-security.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build> <build>
<finalName>sso</finalName> <finalName>sso</finalName>
<resources> <resources>
<resource> <resource>
<directory>lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory> <directory>src/main/resources</directory>
<includes> <excludes>
<include>*.yml</include> <exclude>bootstrap.yml</exclude>
<include>**/*.xml</include> </excludes>
</includes>
</resource> </resource>
</resources> </resources>
...@@ -184,11 +70,6 @@ ...@@ -184,11 +70,6 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>
-Xmx128M
</jvmArguments>
</configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
......
...@@ -4,14 +4,17 @@ import org.springframework.boot.SpringApplication; ...@@ -4,14 +4,17 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.PropertySource;
@SpringBootApplication @SpringBootApplication
@EnableDiscoveryClient @EnableDiscoveryClient
@ComponentScan(basePackages = {"com.keymobile.login", "com.keymobile.config.logging"}) @ComponentScan(basePackages = {"com.keymobile.config.logging", "com.keymobile.config.naming",
public class LoginApplication { "com.keymobile.config.redisclient"})
@PropertySource(value = "classpath:/application.yml")
public class SsoApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(LoginApplication.class, args); SpringApplication.run(SsoApplication.class, args);
} }
} }
package com.keymobile.login.api; package com.keymobile.login.api;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
......
package com.keymobile.login.conf; package com.keymobile.login.conf;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
@Component @Component
public class RESTAuthenticationEntryPoint implements AuthenticationEntryPoint { public class RESTAuthenticationEntryPoint implements AuthenticationEntryPoint {
@Override @Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) public void commence(HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, AuthenticationException authException)
throws IOException, ServletException { throws IOException, ServletException {
response.sendError(HttpServletResponse.SC_UNAUTHORIZED); response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
} }
......
package com.keymobile.login.conf; package com.keymobile.login.conf;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
@Component @Component
...@@ -18,4 +18,4 @@ public class RESTAuthenticationFailureHandler extends SimpleUrlAuthenticationFai ...@@ -18,4 +18,4 @@ public class RESTAuthenticationFailureHandler extends SimpleUrlAuthenticationFai
super.onAuthenticationFailure(request, response, exception); super.onAuthenticationFailure(request, response, exception);
} }
} }
\ No newline at end of file
package com.keymobile.login.conf; package com.keymobile.login.conf;
import com.keymobile.login.logging.LogConstants; import jakarta.servlet.ServletException;
import com.keymobile.login.logging.LogManager; import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler; import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
@Component @Component
public class RESTAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler { public class RESTAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
@Value("${security.allowRootLogin:true}") @Value("${security.allowRootLogin:true}")
private boolean rootAllowLogin = true; private boolean rootAllowLogin = true;
@Override @Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws IOException, ServletException { Authentication authentication) throws IOException, ServletException {
clearAuthenticationAttributes(request); clearAuthenticationAttributes(request);
String returnStatus = "ok"; String returnStatus = "ok";
//check if allow root login
UserDetails userDetails = (UserDetails) authentication.getPrincipal(); UserDetails userDetails = (UserDetails) authentication.getPrincipal();
String userNameWithIdAttached = userDetails.getUsername(); String userNameWithIdAttached = userDetails.getUsername();
LogManager.logInfo(LogConstants.CTX_API, userNameWithIdAttached + " 登录了系统");
if (userNameWithIdAttached.split(":")[0].equalsIgnoreCase("root") if (userNameWithIdAttached.split(":")[0].equalsIgnoreCase("root")
&& !rootAllowLogin) && !rootAllowLogin)
returnStatus = "root not allow login"; returnStatus = "root not allow login";
PrintWriter writer = response.getWriter(); PrintWriter writer = response.getWriter();
writer.write(returnStatus); writer.write(returnStatus);
writer.flush(); writer.flush();
......
package com.keymobile.login.conf; package com.keymobile.login.conf;
import com.keymobile.auth.common.security.GrantedAuthHelper; import jakarta.servlet.ServletException;
import com.keymobile.login.logging.LogConstants; import jakarta.servlet.http.HttpServletRequest;
import com.keymobile.login.logging.LogManager; import jakarta.servlet.http.HttpServletResponse;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
@Component @Component
public class RESTLogoutSuccessHandler implements LogoutSuccessHandler { public class RESTLogoutSuccessHandler implements LogoutSuccessHandler {
@Override @Override
public void onLogoutSuccess(HttpServletRequest request, public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
HttpServletResponse response, Authentication authentication)
throws IOException, ServletException {
if (authentication != null) {
UserDetails userDetails = (UserDetails) authentication.getPrincipal();
String userNameWithIdAttached = userDetails != null ? userDetails.getUsername() : authentication.getName();
LogManager.logInfo(LogConstants.CTX_API, userNameWithIdAttached + " 退出了系统");
}
response.setStatus(HttpStatus.OK.value()); response.setStatus(HttpStatus.OK.value());
response.getWriter().flush(); response.getWriter().flush();
} }
} }
\ No newline at end of file
package com.keymobile.login.conf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.ListOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.SetOperations;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.data.redis.core.ZSetOperations;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
@Configuration
public class RedisConf {
/**
* 注入 RedisConnectionFactory
*/
@Autowired
RedisConnectionFactory redisConnectionFactory;
/**
* 实例化 RedisTemplate 对象
*
* @return
*/
@Bean
public RedisTemplate<String, Object> functionDomainRedisTemplate() {
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
initDomainRedisTemplate(redisTemplate, redisConnectionFactory);
return redisTemplate;
}
/**
* 设置数据存入 redis 的序列化方式
*
* @param redisTemplate
* @param factory
*/
private void initDomainRedisTemplate(RedisTemplate<String, Object> redisTemplate, RedisConnectionFactory factory) {
redisTemplate.setKeySerializer(new StringRedisSerializer());
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
redisTemplate.setHashValueSerializer(new GenericJackson2JsonRedisSerializer());
redisTemplate.setValueSerializer(new GenericJackson2JsonRedisSerializer());
redisTemplate.setConnectionFactory(factory);
}
/**
* 实例化 HashOperations 对象,可以使用 Hash 类型操作
*
* @param redisTemplate
* @return
*/
@Bean
public HashOperations<String, String, Object> hashOperations(RedisTemplate<String, Object> redisTemplate) {
return redisTemplate.opsForHash();
}
/**
* 实例化 ValueOperations 对象,可以使用 String 操作
*
* @param redisTemplate
* @return
*/
@Bean
public ValueOperations<String, Object> valueOperations(RedisTemplate<String, Object> redisTemplate) {
return redisTemplate.opsForValue();
}
/**
* 实例化 ListOperations 对象,可以使用 List 操作
*
* @param redisTemplate
* @return
*/
@Bean
public ListOperations<String, Object> listOperations(RedisTemplate<String, Object> redisTemplate) {
return redisTemplate.opsForList();
}
/**
* 实例化 SetOperations 对象,可以使用 Set 操作
*
* @param redisTemplate
* @return
*/
@Bean
public SetOperations<String, Object> setOperations(RedisTemplate<String, Object> redisTemplate) {
return redisTemplate.opsForSet();
}
/**
* 实例化 ZSetOperations 对象,可以使用 ZSet 操作
*
* @param redisTemplate
* @return
*/
@Bean
public ZSetOperations<String, Object> zSetOperations(RedisTemplate<String, Object> redisTemplate) {
return redisTemplate.opsForZSet();
}}
package com.keymobile.login.conf;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.session.data.redis.config.ConfigureRedisAction;
@Configuration
class RedisSecurity {
@Bean
public static ConfigureRedisAction configureRedisAction() {
return ConfigureRedisAction.NO_OP;
}
}
package com.keymobile.login.conf; package com.keymobile.login.conf;
import com.keymobile.auth.common.security.CustomizedUserDetailService;
import com.keymobile.authservice.component.CustomizedUserDetailService;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.crypto.password.NoOpPasswordEncoder; import org.springframework.security.crypto.password.NoOpPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.provisioning.UserDetailsManager;
import org.springframework.security.web.SecurityFilterChain;
import javax.sql.DataSource;
@Configuration @Configuration
@ComponentScan("com.keymobile.auth.common.security") @EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter { @EnableGlobalMethodSecurity(prePostEnabled = true)
@ComponentScan("com.keymobile.authservice.component")
public class SecurityConfig {
@Autowired @Autowired
private CustomizedUserDetailService customUserDetailService;
@Autowired
private RESTAuthenticationEntryPoint authenticationEntryPoint; private RESTAuthenticationEntryPoint authenticationEntryPoint;
@Autowired @Autowired
private RESTAuthenticationFailureHandler authenticationFailureHandler; private RESTAuthenticationFailureHandler authenticationFailureHandler;
...@@ -26,13 +35,19 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -26,13 +35,19 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired @Autowired
private RESTLogoutSuccessHandler logoutSuccessHandler; private RESTLogoutSuccessHandler logoutSuccessHandler;
@Autowired @Bean
public void configure(AuthenticationManagerBuilder auth) throws Exception { public UserDetailsManager users(DataSource dataSource) {
auth.userDetailsService(customUserDetailService).passwordEncoder(NoOpPasswordEncoder.getInstance()); return new CustomizedUserDetailService(dataSource);
}
@Bean
public PasswordEncoder passwordEncoder() {
return NoOpPasswordEncoder.getInstance();
} }
@Override @Bean
protected void configure(HttpSecurity http) throws Exception { protected SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http.authorizeRequests().anyRequest().permitAll(); http.authorizeRequests().anyRequest().permitAll();
http.csrf().disable(); http.csrf().disable();
http.exceptionHandling().authenticationEntryPoint(authenticationEntryPoint); http.exceptionHandling().authenticationEntryPoint(authenticationEntryPoint);
...@@ -42,6 +57,22 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -42,6 +57,22 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
http.formLogin().loginProcessingUrl("/signin"); http.formLogin().loginProcessingUrl("/signin");
http.logout().logoutUrl("/signout"); http.logout().logoutUrl("/signout");
http.logout().logoutSuccessHandler(logoutSuccessHandler); http.logout().logoutSuccessHandler(logoutSuccessHandler);
return http.build();
}
class SHA1PasswordEncoder implements PasswordEncoder {
@Override
public String encode(CharSequence charSequence) {
return DigestUtils.sha1Hex(charSequence.toString());
}
@Override
public boolean matches(CharSequence charSequence, String s) {
return DigestUtils.sha1Hex(charSequence.toString()).equals(s);
}
} }
} }
...@@ -2,6 +2,6 @@ package com.keymobile.login.logging; ...@@ -2,6 +2,6 @@ package com.keymobile.login.logging;
public interface LogConstants { public interface LogConstants {
String CTX_API = "sso.API"; String CTX_AUDIT = "sso.AUDIT";
} }
spring:
session:
redis:
namespace: default
data:
redis:
host: redis0
port: 6379
password: password0
datasource:
hikari:
maximum-pool-size: 5
url: jdbc:mysql://mysql0:3306/d0?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useSsl=false
username: user0
password: password0
driver-class-name: dm.jdbc.driver.DmDriver
eureka:
client:
registryFetchIntervalSeconds: 5
region: default
serviceUrl:
defaultZone: http://e0:8081/eureka/
enabled: true
\ No newline at end of file
server:
port: 8764
eureka:
client:
registerWithEureka: true
region: default
registryFetchIntervalSeconds: 5
serviceUrl:
defaultZone: http://192.168.0.111:8081/eureka/
instance:
prefer-ip-address: false
hostname: 192.168.0.143
spring:
session:
store-type: redis
redis:
namespace: dataplatformdev
redis:
host: 192.168.0.192
port: 6379
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://192.168.0.192:3306/cgn2_dev?autoReconnect=true
username: test
password: test
security:
authUser: root
authPwd: pwd
permit: false
allowRootLogin: true
logging:
config: classpath:logback-custom.xml
\ No newline at end of file
jasypt.encryptor.algorithm=PBEWithMD5AndDES
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
\ No newline at end of file
server:
port: 8764
spring:
application:
name: auth
cloud:
openfeign:
httpclient:
connection-timeout: 1000
ok-http:
read-timeout: 5000
profiles:
active: default
management:
metrics:
tags:
application: ${spring.application.name}
endpoints:
health:
show-details: always
web:
exposure:
include: prometheus
logging:
level:
root: info
config: classpath:logback-custom.xml
spring: spring:
profiles:
active: test
application: application:
name: auth name: auth
profiles:
active: local
cloud: cloud:
config: config:
uri: uri: http://192.168.0.39:8082
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<configuration> <configuration>
<springProperty name="spring.redis.host" source="spring.redis.host"/> <springProperty name="redis.host" source="spring.data.redis.host"/>
<springProperty name="spring.redis.port" source="spring.redis.port"/> <springProperty name="redis.port" source="spring.data.redis.port"/>
<springProperty name="redis.password" source="spring.data.redis.password"/>
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender"> <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %X{user} %X{session} %-5level %logger{5} - %msg%n</pattern> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %X{user} %X{session} %-5level %logger{5} - %msg%n</pattern>
</encoder> </encoder>
</appender> </appender>
<appender name="logstash" class="com.cwbase.logback.RedisAppender"> <appender name="logstash" class="com.keymobile.config.logging.RedisAppender">
<host>${spring.redis.host}</host> <host>${redis.host}</host>
<port>${spring.redis.port}</port> <port>${redis.port}</port>
<password>${redis.password}</password>
<key>logstash</key> <key>logstash</key>
<additionalField>
<key>user</key>
<value>@{user}</value>
</additionalField>
<additionalField>
<key>session</key>
<value>@{session}</value>
</additionalField>
</appender> </appender>
<logger name="dataModeler.AUDIT"> <logger name="sso.AUDIT">
<appender-ref ref="logstash" /> <appender-ref ref="logstash" />
</logger> </logger>
<root level="INFO"> <root level="INFO">
<appender-ref ref="logstash" />
<appender-ref ref="stdout" /> <appender-ref ref="stdout" />
</root> </root>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment