feat: add OpenBao + Zitadel OIDC device-code token integration
This commit is contained in:
1 parent
d399919690
commit
9188bfc277
9 files changed
+1232
-15
No files matched your search
+74
-2
@@ -41,6 +41,34 @@ export const CheckpointSummarySchema = z.object({
|
||||
|
||||
export type CheckpointSummary = z.output<typeof CheckpointSummarySchema>;
|
||||
|
||||
export const TokenSourceSchema = z.enum(["settings", "openbao", "env", "none"]);
|
||||
export type TokenSource = z.output<typeof TokenSourceSchema>;
|
||||
|
||||
export const OpenBaoPendingAuthSchema = z.object({
|
||||
flowId: z.string(),
|
||||
userCode: z.string(),
|
||||
verificationUri: z.string(),
|
||||
verificationUriComplete: z.string(),
|
||||
expiresAt: z.string(),
|
||||
status: z.enum(["pending", "complete", "error"]),
|
||||
error: z.string().nullable(),
|
||||
});
|
||||
|
||||
export type OpenBaoPendingAuth = z.output<typeof OpenBaoPendingAuthSchema>;
|
||||
|
||||
export const OpenBaoStatusSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
authenticated: z.boolean(),
|
||||
displayName: z.string().nullable(),
|
||||
policies: z.array(z.string()),
|
||||
tokenPresent: z.boolean(),
|
||||
lastPulledAt: z.string().nullable(),
|
||||
lastError: z.string().nullable(),
|
||||
pendingAuth: OpenBaoPendingAuthSchema.nullable(),
|
||||
});
|
||||
|
||||
export type OpenBaoStatus = z.output<typeof OpenBaoStatusSchema>;
|
||||
|
||||
export const testConnectionRpc = defineRpc({
|
||||
name: "sprites.test",
|
||||
input: z.object({}),
|
||||
@@ -48,7 +76,7 @@ export const testConnectionRpc = defineRpc({
|
||||
z.object({
|
||||
ok: z.literal(true),
|
||||
spriteCount: z.number(),
|
||||
source: z.enum(["settings", "env"]),
|
||||
source: z.enum(["settings", "openbao", "env"]),
|
||||
}),
|
||||
z.object({
|
||||
ok: z.literal(false),
|
||||
@@ -64,13 +92,57 @@ export const statusRpc = defineRpc({
|
||||
}),
|
||||
output: z.object({
|
||||
configured: z.boolean(),
|
||||
tokenSource: z.enum(["settings", "env", "none"]),
|
||||
tokenSource: TokenSourceSchema,
|
||||
remoteError: z.string().nullable(),
|
||||
sprites: z.array(SpriteSummarySchema),
|
||||
workers: z.array(WorkerSummarySchema),
|
||||
}),
|
||||
});
|
||||
|
||||
export const openbaoStatusRpc = defineRpc({
|
||||
name: "openbao.status",
|
||||
input: z.object({}),
|
||||
output: OpenBaoStatusSchema,
|
||||
});
|
||||
|
||||
export const openbaoAuthStartRpc = defineRpc({
|
||||
name: "openbao.auth.start",
|
||||
input: z.object({}),
|
||||
output: z.discriminatedUnion("ok", [
|
||||
z.object({
|
||||
ok: z.literal(true),
|
||||
pendingAuth: OpenBaoPendingAuthSchema,
|
||||
}),
|
||||
z.object({
|
||||
ok: z.literal(false),
|
||||
error: z.string(),
|
||||
}),
|
||||
]),
|
||||
});
|
||||
|
||||
export const openbaoPullRpc = defineRpc({
|
||||
name: "openbao.pull",
|
||||
input: z.object({}),
|
||||
output: z.discriminatedUnion("ok", [
|
||||
z.object({
|
||||
ok: z.literal(true),
|
||||
status: OpenBaoStatusSchema,
|
||||
}),
|
||||
z.object({
|
||||
ok: z.literal(false),
|
||||
error: z.string(),
|
||||
}),
|
||||
]),
|
||||
});
|
||||
|
||||
export const openbaoLogoutRpc = defineRpc({
|
||||
name: "openbao.logout",
|
||||
input: z.object({}),
|
||||
output: z.object({
|
||||
ok: z.literal(true),
|
||||
}),
|
||||
});
|
||||
|
||||
export const createSpriteRpc = defineRpc({
|
||||
name: "sprites.create",
|
||||
input: z.object({
|
||||
|
||||
Reference in new issue
Block a user