feat: added simplereenroll

This commit is contained in:
Sheen Capadngan
2024-08-20 23:56:27 +08:00
parent 2d7ff66246
commit 760a1e917a
4 changed files with 225 additions and 41 deletions
@@ -83,7 +83,7 @@ export const registerCertificateEstRouter = async (server: FastifyZodProvider) =
certificateTemplateId: z.string().min(1)
}),
response: {
200: z.object({})
200: z.string()
}
},
handler: async (req, res) => {
@@ -97,4 +97,31 @@ export const registerCertificateEstRouter = async (server: FastifyZodProvider) =
});
}
});
server.route({
method: "POST",
url: "/:certificateTemplateId/simplereenroll",
config: {
rateLimit: writeLimit
},
schema: {
body: z.string().min(1),
params: z.object({
certificateTemplateId: z.string().min(1)
}),
response: {
200: z.string()
}
},
handler: async (req, res) => {
void res.header("Content-Type", "application/pkcs7-mime; smime-type=certs-only");
void res.header("Content-Transfer-Encoding", "base64");
return server.services.certificateEst.simpleReenroll({
csr: req.body,
certificateTemplateId: req.params.certificateTemplateId,
sslClientCert: req.headers["x-ssl-client-cert"] as string
});
}
});
};
+6 -1
View File
@@ -660,7 +660,12 @@ export const registerRoutes = async (
const certificateEstService = certificateEstServiceFactory({
certificateAuthorityService,
certificateTemplateService
certificateTemplateService,
certificateTemplateDAL,
certificateAuthorityCertDAL,
certificateAuthorityDAL,
projectDAL,
kmsService
});
const pkiAlertService = pkiAlertServiceFactory({