From f23c20d82b3f495a08acbc902c102ba14df608fc Mon Sep 17 00:00:00 2001 From: Wanda Date: Wed, 11 Jun 2025 09:21:49 +0700 Subject: [PATCH] update --- build.gradle | 5 +- cert/esbuat-djpbdomain.der | Bin 0 -> 1784 bytes .../gateway/span/config/JwtAuthFilter.java | 2 +- .../span/controllers/AuthController.java | 4 +- .../span/services/HttpClientService.java | 74 ++++++++++-------- src/main/resources/application.yaml | 19 ++++- 6 files changed, 61 insertions(+), 43 deletions(-) create mode 100644 cert/esbuat-djpbdomain.der diff --git a/build.gradle b/build.gradle index 9ce69f8..d5382aa 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ plugins { group = 'id.co.anaheim' //version = '0.0.5-SNAPSHOT' -version = '0.0.6' +version = '0.0.13-Prod' java { toolchain { @@ -29,7 +29,6 @@ ext { } dependencies { - implementation 'org.springframework.boot:spring-boot-starter-actuator' implementation 'org.springframework.boot:spring-boot-starter-jdbc' implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-web' @@ -45,7 +44,7 @@ dependencies { implementation 'io.azam.ulidj:ulidj:1.0.4' implementation 'com.bucket4j:bucket4j-core:8.3.0' - implementation 'org.asynchttpclient:async-http-client:3.0.0' + implementation 'org.asynchttpclient:async-http-client:3.0.1' compileOnly 'org.projectlombok:lombok' runtimeOnly 'com.oracle.database.jdbc:ojdbc11' diff --git a/cert/esbuat-djpbdomain.der b/cert/esbuat-djpbdomain.der new file mode 100644 index 0000000000000000000000000000000000000000..69f9606839fee69d762318222605a2e0f950042f GIT binary patch literal 1784 zcmbVMcTf{~6yDuzmX;tIOaKEcO^u%6m(ZlBAiWHrp&X(}3=k=X7R-UjNRXfdGL9lD zDg<(HAe`cP_OYE3E{jEFib5;8^~-xt-bBeQ&?t`(F9>0Xa4VSA9E$DcT|Rj{zOin5XbkjM8D4PK7`iPYY;ZlwcHNAi)COOu!%w zO$N;^RvhaZog&4(B_f^`;E`?$W8P=CXF}o{VFK>S$AkO?_;P^@F7R^U+t}iKzz4Xi z3lA8v=zMEn&9em`uN8!8Lz;Xm8+#l36=3xj)ZT79CeS50)EIOhVZ1O!D#QcRQiW2U zA(-_kC0*a>b6hig zREQ#nr$K~Y6OqF()cA9Mqt7-OE5q2*uCv02x4Pg`*1Ilj8I!M!D_(F6>Kz+Oq8>dL z^`iV*4%YiB?&t2*9$pqxr<7(uD5Z@)apz$7VSI|xm|ruQbvlK zevNt5qn)RD<5f;$!M-MfxM2J9&qqrhjih0FSw<5>2|)&tV>#vdWBF~BqVcUeV|reH z@QX4!l-aPcRFSGO$jO_nVsBX6V30GYwsKtm+CV^1y#9T(`^}>)$MqeXU$y!Fswl09 zNIrq}20j#S@z*?CRvPF9He)g(64Fvv9ql&G{ie3T?UqrpQob>fvx9MRD5YlJ)rb)~Mh1=5+6hY;%gt+72wa|K~ zd3wl;+uY2RHe0;MQt_m|e6e9-h`xS^dj#1n18!>rfPxm8|nwpz_HdoAG>9tDf;8 z2wKzfz&+y0FapV-jbTPJ9{x0M16wH0j2M6OXWmL(rT?zdQxwa)+6CP7lass}A9=li z2fv=W>-w=W|#{D5&xq4uKMC7pxsnHL7T?igbNa20=fg`w%_+Q1tJeB5x0v;w@uuOL6~Zuc=lkx<@e-)H zTh(^2Nv>8iXgE@B=-}_B z$NMA8G?)rsVTy6e%YrfW{Fj`7n8V&jZn5_7cY+1s@#V5Tu(Gn1mNhaw`{r>3>8ohm heZgmd*6dInyjL}U&_XfcHGmgxTBoC$HF%>)@-GkSef token = request.headers().header("token"); - boundRequestBuilder.addHeader("token", token); - } - if (!request.headers().header("Authorization").isEmpty()) { - String authorizationHeader = request.headers().header("Authorization").get(0); - String token = authorizationHeader.substring(7); - JwtUsername username = jwtService.extractUsername(token); - if (username.isValid() && !username.getValue().equals("admin")) { - String staticToken = jwtService.extractStaticToken(token); - if (staticToken != null) { - boundRequestBuilder.addHeader("token", staticToken); - } + try (AsyncHttpClient asyncHttpClient = asyncHttpClient()) { + BoundRequestBuilder boundRequestBuilder = asyncHttpClient + .prepare(request.method().toString(), url) + //.setReadTimeout(Duration.ofMinutes(120)) + //.setRequestTimeout(Duration.ofMinutes(120)) + .setReadTimeout(Duration.ofMinutes(15)) + .setRequestTimeout(Duration.ofMinutes(15)) + .setBody(body) + .addHeader("Content-Type", request.headers().header("Content-Type")); + if (!request.headers().header("token").isEmpty()) { + List token = request.headers().header("token"); + boundRequestBuilder.addHeader("token", token); } + if (!request.headers().header("Authorization").isEmpty()) { + String authorizationHeader = request.headers().header("Authorization").get(0); + String token = authorizationHeader.substring(7); + JwtUsername username = jwtService.extractUsername(token); + if (username.isValid() && !username.getValue().equals("admin")) { + String staticToken = jwtService.extractStaticToken(token); + if (staticToken != null) { + boundRequestBuilder.addHeader("token", staticToken); + } + } + } + Future whenResponse = boundRequestBuilder + .execute(); + log.info("request {} {}", request.method(), url); + log.info("request headers {}", request.headers()); + + Response response = whenResponse.get(); + log.info("Response {}", response); + log.info("Response Body {}", response.getResponseBody()); + log.info("Response Content Type {} ", response.getContentType()); + return ServerResponse.status(response.getStatusCode()) + .header("Content-Type", response.getContentType()) + .body(response.getResponseBody()); + } catch (IOException | ExecutionException | InterruptedException e) { + log.error("Http error", e); } - Future whenResponse = boundRequestBuilder - .execute(); - log.info("request {} {}", request.method(), url); - log.info("request headers {}", request.headers()); - Response response = whenResponse.get(); - log.info("Response {}", response); - log.info("Response Body {}", response.getResponseBody()); - log.info("Response Content Type {} ", response.getContentType()); - return ServerResponse.status(response.getStatusCode()) - .header("Content-Type", response.getContentType()) - .body(response.getResponseBody()); } catch (Exception e) { log.error("handleException - failed to run request again {}", url, e); } diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index ca6c4a9..c063614 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -1,15 +1,24 @@ server: port: 8888 #prod #port: 8778 #dev + tomcat: + max-swallow-size: 8192MB + max-http-form-post-size: 8192MB spring: datasource: - url: jdbc:oracle:thin:@//10.216.100.100:1521/pdbsoadev + #url: jdbc:oracle:thin:@//10.216.100.100:1521/pdbsoauat + #url: jdbc:oracle:thin:@//10.216.100.100:1521/pdbsoadev + #url: jdbc:oracle:thin:@//soadb:1521/pdbsoauat + url: jdbc:oracle:thin:@//dbmsoascan.kemenkeu.go.id:1521/pdbsoaprod.kemenkeu.go.id #url: jdbc:oracle:thin:@localhost:1521:oracle - username: gateway + username: master_user #username: gateway - password: welcome1 + #username: gateway + password: m4sterPassw0rd1 #password: gateway + hikari: + schema: gateway cloud: gateway: mvc: @@ -26,7 +35,9 @@ spring: app: gateway: remote-servers: - span: http://10.216.99.101:8002 + #span: https://esbuat-djpb.kemenkeu.go.id + span: https://esb-djpb.kemenkeu.go.id + #span: http://10.216.99.101:8002 #span: https://672fbf9066e42ceaf15e9a9b.mockapi.io users: http://localhost:8989 #users: http://localhost:8779