mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Merge pull request #3680 from Infisical/misc/pki-improvements
misc: general improvements
This commit is contained in:
@@ -311,7 +311,6 @@ export const certificateAuthorityServiceFactory = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const updatedCa = await internalCertificateAuthorityService.updateCaById({
|
const updatedCa = await internalCertificateAuthorityService.updateCaById({
|
||||||
...configuration,
|
|
||||||
isInternal: true,
|
isInternal: true,
|
||||||
enableDirectIssuance,
|
enableDirectIssuance,
|
||||||
caId: certificateAuthority.id,
|
caId: certificateAuthority.id,
|
||||||
|
|||||||
@@ -55,8 +55,4 @@ export const CreateInternalCertificateAuthoritySchema = GenericCreateCertificate
|
|||||||
configuration: InternalCertificateAuthorityConfigurationSchema
|
configuration: InternalCertificateAuthorityConfigurationSchema
|
||||||
});
|
});
|
||||||
|
|
||||||
export const UpdateInternalCertificateAuthoritySchema = GenericUpdateCertificateAuthorityFieldsSchema(
|
export const UpdateInternalCertificateAuthoritySchema = GenericUpdateCertificateAuthorityFieldsSchema(CaType.INTERNAL);
|
||||||
CaType.INTERNAL
|
|
||||||
).extend({
|
|
||||||
configuration: InternalCertificateAuthorityConfigurationSchema.optional()
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -137,6 +137,15 @@ export const pkiSubscriberServiceFactory = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ca = await certificateAuthorityDAL.findById(caId);
|
||||||
|
if (!ca) {
|
||||||
|
throw new NotFoundError({ message: `CA with ID '${caId}' not found` });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ca.projectId !== projectId) {
|
||||||
|
throw new BadRequestError({ message: "CA does not belong to the project" });
|
||||||
|
}
|
||||||
|
|
||||||
const newSubscriber = await pkiSubscriberDAL.create({
|
const newSubscriber = await pkiSubscriberDAL.create({
|
||||||
caId,
|
caId,
|
||||||
projectId,
|
projectId,
|
||||||
@@ -245,6 +254,17 @@ export const pkiSubscriberServiceFactory = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (caId) {
|
||||||
|
const ca = await certificateAuthorityDAL.findById(caId);
|
||||||
|
if (!ca) {
|
||||||
|
throw new NotFoundError({ message: `CA with ID '${caId}' not found` });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ca.projectId !== projectId) {
|
||||||
|
throw new BadRequestError({ message: "CA does not belong to the project" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const updatedSubscriber = await pkiSubscriberDAL.updateById(subscriber.id, {
|
const updatedSubscriber = await pkiSubscriberDAL.updateById(subscriber.id, {
|
||||||
caId,
|
caId,
|
||||||
name,
|
name,
|
||||||
|
|||||||
@@ -31,10 +31,14 @@ export const useUpdateCa = () => {
|
|||||||
|
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
onSuccess: ({ projectId, type }) => {
|
onSuccess: ({ projectId, type }, { caName }) => {
|
||||||
|
caKeys.getCaByNameAndProjectId(caName, projectId);
|
||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
queryKey: caKeys.listCasByTypeAndProjectId(type, projectId)
|
queryKey: caKeys.listCasByTypeAndProjectId(type, projectId)
|
||||||
});
|
});
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: caKeys.getCaByNameAndProjectId(caName, projectId)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -188,11 +188,7 @@ export const CaModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
name,
|
name,
|
||||||
type: CaType.INTERNAL,
|
type: CaType.INTERNAL,
|
||||||
status,
|
status,
|
||||||
enableDirectIssuance,
|
enableDirectIssuance
|
||||||
configuration: {
|
|
||||||
...configuration,
|
|
||||||
maxPathLength: Number(configuration.maxPathLength)
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// create
|
// create
|
||||||
|
|||||||
Reference in New Issue
Block a user