Commit 969b0f59 authored by Josh Ji's avatar Josh Ji

zipkin

parent 72c83d6d
Pipeline #5708 failed with stage
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#WORKDIR /tmp #WORKDIR /tmp
#RUN mvn clean package -DskipTests #RUN mvn clean package -DskipTests
FROM openjdk:11-jre-slim FROM openjdk:23-slim-bullseye
#COPY --from=build /tmp/target/*.jar app.jar #COPY --from=build /tmp/target/*.jar app.jar
COPY target/*.jar app.jar COPY target/*.jar app.jar
EXPOSE 443 EXPOSE 443
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.4</version> <version>3.1.2</version>
<relativePath/> <!-- lookup parent from repository --> <relativePath/> <!-- lookup parent from repository -->
</parent> </parent>
<groupId>com.example</groupId> <groupId>com.example</groupId>
...@@ -16,13 +16,12 @@ ...@@ -16,13 +16,12 @@
<name>RPServer</name> <name>RPServer</name>
<description>RPServer</description> <description>RPServer</description>
<properties> <properties>
<java.version>11</java.version> <java.version>17</java.version>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId> <artifactId>spring-boot-starter-thymeleaf</artifactId>
<version>2.7.5</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
...@@ -62,6 +61,18 @@ ...@@ -62,6 +61,18 @@
<artifactId>cbor</artifactId> <artifactId>cbor</artifactId>
<version>0.8</version> <version>0.8</version>
</dependency> </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>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -2,6 +2,9 @@ package com.example.rpserver; ...@@ -2,6 +2,9 @@ package com.example.rpserver;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
@SpringBootApplication @SpringBootApplication
public class RpServerApplication { public class RpServerApplication {
...@@ -10,4 +13,8 @@ public class RpServerApplication { ...@@ -10,4 +13,8 @@ public class RpServerApplication {
SpringApplication.run(RpServerApplication.class, args); SpringApplication.run(RpServerApplication.class, args);
} }
@Bean
RestTemplate restTemplate(RestTemplateBuilder builder){
return builder.build();
}
} }
...@@ -54,8 +54,7 @@ public class MakeCredential { ...@@ -54,8 +54,7 @@ public class MakeCredential {
@RequestParam("attachment") String attachment, @RequestParam("attachment") String attachment,
@RequestParam("username") String username) @RequestParam("username") String username)
{ {
logger.info("timestamp beginMakeCredential {}", System.currentTimeMillis());
byte[] userIdBytes = new byte[32]; byte[] userIdBytes = new byte[32];
secureRandom.nextBytes(userIdBytes); secureRandom.nextBytes(userIdBytes);
...@@ -90,7 +89,7 @@ public class MakeCredential { ...@@ -90,7 +89,7 @@ public class MakeCredential {
FidoUser fidoUser = new FidoUser(userIdBytes, challenge.toString(), username); FidoUser fidoUser = new FidoUser(userIdBytes, challenge.toString(), username);
userRepository.save(fidoUser); userRepository.save(fidoUser);
logger.info("timestamp beginMakeCredentialReturn {}", System.currentTimeMillis());
return ResponseEntity.ok(options); return ResponseEntity.ok(options);
} }
...@@ -101,6 +100,8 @@ public class MakeCredential { ...@@ -101,6 +100,8 @@ public class MakeCredential {
@RequestParam("clientDataJSON") byte[] clientDataJSONBytes, @RequestParam("clientDataJSON") byte[] clientDataJSONBytes,
@RequestParam("attestationObject") byte[] attestationObjectBytes, @RequestParam("attestationObject") byte[] attestationObjectBytes,
@RequestHeader Map<String, String> headers){ @RequestHeader Map<String, String> headers){
logger.info("timestamp finishMakeCredential {}", System.currentTimeMillis());
// apply base64 decoding // apply base64 decoding
clientDataJSONBytes = Base64Util.decode(clientDataJSONBytes); clientDataJSONBytes = Base64Util.decode(clientDataJSONBytes);
attestationObjectBytes = Base64Util.decode(attestationObjectBytes); attestationObjectBytes = Base64Util.decode(attestationObjectBytes);
...@@ -143,7 +144,7 @@ public class MakeCredential { ...@@ -143,7 +144,7 @@ public class MakeCredential {
null, null,
user.getUserName(), user.getUserName(),
rawId)); rawId));
logger.info("timestamp finishMakeCredentialReturn {}", System.currentTimeMillis());
return ResponseEntity.ok().body(new Response(true, "Successfully created credential", identityFromIDP)); return ResponseEntity.ok().body(new Response(true, "Successfully created credential", identityFromIDP));
} }
...@@ -188,8 +189,12 @@ public class MakeCredential { ...@@ -188,8 +189,12 @@ public class MakeCredential {
@Autowired @Autowired
Environment env; Environment env;
@Autowired
RestTemplate restTemplate;
private String askIDP(String[] param){ private String askIDP(String[] param){
RestTemplate restTemplate = new RestTemplate(); logger.info("timestamp askIDP {}", System.currentTimeMillis());
String idp_addr = env.getProperty("server.idp.url"); String idp_addr = env.getProperty("server.idp.url");
HashMap<String, String> map = new HashMap<>(); HashMap<String, String> map = new HashMap<>();
String uri = idp_addr; String uri = idp_addr;
...@@ -209,6 +214,7 @@ public class MakeCredential { ...@@ -209,6 +214,7 @@ public class MakeCredential {
break; break;
} }
} }
logger.info("timestamp askIDPReturn {}", System.currentTimeMillis());
return restTemplate.postForObject(uri, map, String.class); return restTemplate.postForObject(uri, map, String.class);
} }
} }
...@@ -2,7 +2,7 @@ package com.example.rpserver.model; ...@@ -2,7 +2,7 @@ package com.example.rpserver.model;
import com.webauthn4j.data.PublicKeyCredentialEntity; import com.webauthn4j.data.PublicKeyCredentialEntity;
import javax.persistence.*; import jakarta.persistence.*;
import java.util.Date; import java.util.Date;
@Entity @Entity
......
package com.example.rpserver.model; package com.example.rpserver.model;
import javax.persistence.*; import jakarta.persistence.*;
@Entity @Entity
@Table @Table
......
...@@ -35,4 +35,13 @@ spring: ...@@ -35,4 +35,13 @@ spring:
ddl-auto: update ddl-auto: update
properties: properties:
hibernate: hibernate:
dialect: org.hibernate.dialect.H2Dialect dialect: org.hibernate.dialect.H2Dialect
\ No newline at end of file application:
name: rpserver
management:
tracing:
sampling:
probability: 1
zipkin:
tracing:
endpoint: http://zipkin:9411/api/v2/spans
...@@ -259,6 +259,7 @@ function serializeUvm(uvm) { ...@@ -259,6 +259,7 @@ function serializeUvm(uvm) {
} }
function registerNewCredential() { function registerNewCredential() {
console.log("timestamp registerNewCredential "+Date.now());
const advancedOptions = {}; const advancedOptions = {};
if (isChecked('#switch-rr')) { if (isChecked('#switch-rr')) {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="favicon.ico"> <link rel="shortcut icon" href="/favicon.ico">
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.teal-pink.min.css" /> <link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.teal-pink.min.css" />
<script src="//code.getmdl.io/1.3.0/material.min.js"></script> <script src="//code.getmdl.io/1.3.0/material.min.js"></script>
<!-- CSS only --> <!-- CSS only -->
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
<!-- <p style="padding-top: 10px; text-align: center; color: gray;"> For Demo</p>--> <!-- <p style="padding-top: 10px; text-align: center; color: gray;"> For Demo</p>-->
<!-- </div>--> <!-- </div>-->
<div > <div >
<img src="img/logo4.png" style="width: 250px;display:block; margin:auto;" alt="logo2"> <img src="/img/logo4.png" style="width: 250px;display:block; margin:auto;" alt="logo2">
<h1 style="text-align: center">FIDO DEMO</h1> <h1 style="text-align: center">FIDO DEMO</h1>
</div> </div>
<!-- <div class="col">--> <!-- <div class="col">-->
...@@ -175,7 +175,7 @@ ...@@ -175,7 +175,7 @@
<!-- JavaScript Bundle with Popper --> <!-- JavaScript Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a+RTT6rIHI7NnikvbZlHgTPOOmMi466C8" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a+RTT6rIHI7NnikvbZlHgTPOOmMi466C8" crossorigin="anonymous"></script>
<script src="js/webauthn.js"></script> <script src="/js/webauthn.js"></script>
<script> <script>
// override fetchCredentials in "js/webauthn.js" // override fetchCredentials in "js/webauthn.js"
function fetchCredentials(){ function fetchCredentials(){
......
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
</head> </head>
<body> <body>
<script>
console.log("timestamp viewProfile " + Date.now());
</script>
<!--navbar--> <!--navbar-->
<nav class="navbar bg-light navbar-light"> <nav class="navbar bg-light navbar-light">
<div class="container-fluid"> <div class="container-fluid">
......
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