* prepare client auth with inbuilt server Signed-off-by: Jens Langhammer <jens@goauthentik.io> * introduce better IPC auth Signed-off-by: Jens Langhammer <jens@goauthentik.io> * init Signed-off-by: Jens Langhammer <jens@goauthentik.io> * start stage Signed-off-by: Jens Langhammer <jens@goauthentik.io> * only allow trusted proxies to set MTLS headers Signed-off-by: Jens Langhammer <jens@goauthentik.io> * more stage progress Signed-off-by: Jens Langhammer <jens@goauthentik.io> * dont fail if ipc_key doesn't exist Signed-off-by: Jens Langhammer <jens@goauthentik.io> * actually install app Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add some tests Signed-off-by: Jens Langhammer <jens@goauthentik.io> * update API Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix unquote Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix int serial number not jsonable Signed-off-by: Jens Langhammer <jens@goauthentik.io> * init ui Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add UI Signed-off-by: Jens Langhammer <jens@goauthentik.io> * unrelated: fix git pull in makefile Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix parse helper Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add test for outpost Signed-off-by: Jens Langhammer <jens@goauthentik.io> * more tests and improvements Signed-off-by: Jens Langhammer <jens@goauthentik.io> * improve labels Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add support for multiple CAs on brand Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add support for multiple CAs to MTLS stage Signed-off-by: Jens Langhammer <jens@goauthentik.io> * dont log ipcuser secret views Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix go mod Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io>
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
|
|
|
import { CertificateKeyPair, CryptoApi } from "@goauthentik/api";
|
|
|
|
const certToSelect = (s: CertificateKeyPair) => [s.pk, s.name, s.name, s];
|
|
|
|
export async function certificateProvider(page = 1, search = "") {
|
|
const certificates = await new CryptoApi(DEFAULT_CONFIG).cryptoCertificatekeypairsList({
|
|
ordering: "name",
|
|
pageSize: 20,
|
|
search: search.trim(),
|
|
page,
|
|
hasKey: undefined,
|
|
});
|
|
return {
|
|
pagination: certificates.pagination,
|
|
options: certificates.results.map(certToSelect),
|
|
};
|
|
}
|
|
|
|
export function certificateSelector(instanceMappings?: string[]) {
|
|
if (!instanceMappings) {
|
|
return [];
|
|
}
|
|
|
|
return async () => {
|
|
const pm = new CryptoApi(DEFAULT_CONFIG);
|
|
const mappings = await Promise.allSettled(
|
|
instanceMappings.map((instanceId) =>
|
|
pm.cryptoCertificatekeypairsRetrieve({ kpUuid: instanceId }),
|
|
),
|
|
);
|
|
|
|
return mappings
|
|
.filter((s) => s.status === "fulfilled")
|
|
.map((s) => s.value)
|
|
.map(certToSelect);
|
|
};
|
|
}
|