Commit 5b3c96c0 authored by Josh Ji's avatar Josh Ji

zipkin

parent 6f7c0ce9
......@@ -3,7 +3,7 @@
#WORKDIR /tmp
#RUN mvn clean package -DskipTests
FROM openjdk:11-jre-slim
FROM openjdk:23-slim-bullseye
#COPY --from=build /tmp/target/*.jar app.jar
COPY target/*.jar app.jar
EXPOSE 8086
......
FROM openjdk:11
FROM openjdk:23-slim-bullseye
COPY target/*.jar app.jar
EXPOSE 8086
ENV SPRING_DATASOURCE_USERNAME=root
......
......@@ -24,6 +24,10 @@ services:
SPRING_DATASOURCE_URL: jdbc:mysql://mysql/idp
ports:
- 8086:8086
zipkin:
image: openzipkin/zipkin
ports:
- 9411:9411
networks:
overlay:
driver: overlay
\ No newline at end of file
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.0</version>
<version>3.1.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.prlab</groupId>
......@@ -15,7 +15,7 @@
<name>IDPServer</name>
<description>IDPServer</description>
<properties>
<java.version>1.8</java.version>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
......@@ -34,6 +34,7 @@
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
<version>8.0.33</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
......@@ -42,6 +43,7 @@
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
......@@ -74,6 +76,23 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
</dependency>
<dependency>
<groupId>net.ttddyy.observation</groupId>
<artifactId>datasource-micrometer-spring-boot</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
<build>
......
package com.prlab.idpserver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
......@@ -8,12 +9,17 @@ import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.csrf.CookieCsrfTokenRepository;
@EnableWebSecurity
@Configuration
public class WebSecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.csrf(AbstractHttpConfigurer::disable);
http.authorizeRequests().anyRequest().permitAll();
http.csrf(AbstractHttpConfigurer::disable)
.formLogin(AbstractHttpConfigurer::disable)
.authorizeHttpRequests(auth->{
auth.anyRequest().permitAll();
})
.httpBasic(AbstractHttpConfigurer::disable);
return http.build();
}
}
\ No newline at end of file
......@@ -38,6 +38,8 @@ public class askIdentityV2 {
@PostMapping("/idp/askIdentityV2")
public String queryIdentity(@RequestBody IdentityRequestV2 r){
logger.info("timestamp askIdentityV2 {}", System.currentTimeMillis());
logger.info("r : {}, {}, {}, {}", r.nonce_base64, r.idHash_base64, r.cE_base64, r.HMAC_base64);
byte[] nonce = Base64Utils.decodeFromString(r.nonce_base64);
byte[] idHash = Base64Utils.decodeFromString(r.idHash_base64);
......@@ -65,6 +67,8 @@ public class askIdentityV2 {
Base64Utils.decodeFromString(r.nonce_base64)},
new int[]{Types.VARBINARY, Types.VARBINARY});
long t2 = System.currentTimeMillis();
logger.info("timestamp dbt1 {}", t1);
logger.info("timestamp dbt2 {}", t2);
logger.info("time consumed: {} ms", t2-t1);
......@@ -107,6 +111,7 @@ public class askIdentityV2 {
throw new RuntimeException(e);
}
});
logger.info("timestamp askIdentityV2return {}", System.currentTimeMillis());
if(list.size()>0)
// return (String)list.get(0).get("id");
return msg.get();
......
server.port=8086
logging.level.com.prlab.idpserver=DEBUG
spring.datasource.url=jdbc:mysql://localhost:3306/idp
spring.datasource.username=IDP
spring.datasource.password=idppasswd
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
server:
port: 8086
spring:
datasource:
url: jdbc:mysql://localhost:3306/idp
username: IDP
password: idppasswd
driver-class-name: com.mysql.cj.jdbc.Driver
application:
name: idpserver
logging:
level:
com.prlab.idpserver: DEBUG
management:
tracing:
sampling:
probability: 1
zipkin:
tracing:
endpoint: http://zipkin:9411/api/v2/spans
\ No newline at end of file
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