Projects

Project delivered with focus on reliability, performance, and maintainability using industry-standard technologies and best practices.

Filter projects

defp process_token_request(conn, rd, start_time) do
  with {:ok, rd} <- TokenInput.validate(rd),
       {:ok, rd} <- TokenIssue.issue(rd),
       {:ok, rd} <- TokenOutput.output(rd),
       {:ok, rd} <- TokenTelemetry.emit(start_time, rd) do
    DataDog.trace_poi_token_success(rd)

    Logger.info(fn ->
      log_prefix = build_log_prefix(rd.trace)
      "jwt.poi.success #{log_prefix} #{Jason.encode!(TraceFormatter.prepare(rd.trace))}"
    end)

    conn
    |> put_resp_content_type("application/json")
    |> send_resp(200, Jason.encode!(rd.output))
  else
    {:error, rd} ->
      {:ok, rd} = TokenTelemetry.emit(start_time, rd)

      DataDog.trace_poi_token_failure(rd)

      Logger.info(fn ->
        log_prefix = build_log_prefix(rd.trace)
        "jwt.poi.failure #{log_prefix} #{Jason.encode!(TraceFormatter.prepare(rd.trace))}"
      end)

      conn
      |> put_resp_content_type("application/json")
      |> send_resp(400, Jason.encode!(%{errors: collect_all_errors(rd.trace)}))
  end
end

Cloud-iA

try {
    CRes cRes = createDataService.createCRes(cres)
    CReq cReq = createDataService.createCReq(creq)
    Session session = createDataService.assembleSession(cRes, cReq, threeDSSessionData)
    crf.withCRes(cRes)
    crf.withCReq(cReq)
    crf.withRequest(httpServletRequest)
    crf.withSession(session)
    if (crf.h2hClientAuthenticated()) {
        crf.createAReqOutput()
        if (crf.error()) {
            responseEntity = crf.outputError()
        } else {
            responseEntity = crf.outputSuccess()
        }
    } else {
        responseEntity = crf.outputH2hClientNotAuthenticated()
    }
} catch (Throwable throwable) {
    crf.logError(throwable)
    responseEntity = crf.outputUnexpectedException()
} finally {
    crf.dataDogTrace()
}

3DS Server

private boolean validateCertificateChain(List<X509Certificate> certificateChain) throws Exception {
    if (certificateChain == null || certificateChain.size() < 2) {
        throw APTokenChainVerifyException.createForIncompleteCertificateChain("ap.verify.chain.postprocess.incomplete.certificate.chain");
    }

    X509Certificate leaf = findCertificateWithOID(certificateChain, "1.2.840.113635.100.6.29");
    X509Certificate intermediate = findCertificateWithOID(certificateChain, "1.2.840.113635.100.6.2.14");

    if (leaf == null || intermediate == null) {
        throw APTokenChainVerifyException.createForMissingMarkerOIDs("ap.verify.chain.postprocess.missing.marker.oids");
    }

    X509Certificate root = certificateChain.get(certificateChain.size() - 1);

    leaf.verify(intermediate.getPublicKey());
    intermediate.verify(root.getPublicKey());

    return true;
}

TecsWeb

public Uni<NotifyPayload> updateDistributionReleaseStatus(NotifyPayload notifyPayload) {
    return Uni.createFrom().item(
            () -> {
                notifyPayload.dataUpdateDistributionReleaseStatus = new DataUpdateDistributionReleaseStatus();
                return notifyPayload;
            }
        )
        .onItem()
        .invoke(
            () -> {
                if (log.isDebugEnabled()) {
                    log.debugf("%s nty.updateDistributionReleaseStatus.str: %s", notifyPayload.dataInput.requestId, System.identityHashCode(notifyPayload));
                }
            }
        )
        .flatMap(updateDistributionReleaseStatusService::updateDistributionReleaseStatus)
        .onItem()
        .invoke(
            () -> {
                if (log.isDebugEnabled()) {
                    log.debugf("%s nty.updateDistributionReleaseStatus.cpl: %s", notifyPayload.dataInput.requestId, System.identityHashCode(notifyPayload));
                }
            }
        );
}

TMS Configuration Provider