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({
|
||||
|
||||
@@ -4,6 +4,16 @@ import { z } from "zod";
|
||||
export const flySpritesSettingsSchema = z.object({
|
||||
token: z.string().default(""),
|
||||
baseUrl: z.string().default("https://api.sprites.dev"),
|
||||
openbaoEnabled: z.boolean().default(true),
|
||||
openbaoAddr: z.string().default("https://bao.site.latha.org"),
|
||||
openbaoAuthMount: z.string().default("jwt"),
|
||||
openbaoRole: z.string().default("admin"),
|
||||
openbaoKvMount: z.string().default("secret"),
|
||||
openbaoSecretPath: z.string().default("paseo"),
|
||||
openbaoSecretKey: z.string().default("FLY_TOKEN"),
|
||||
zitadelIssuer: z.string().default("https://auth.site.latha.org"),
|
||||
zitadelClientId: z.string().default("400222693598691513"),
|
||||
zitadelScope: z.string().default("openid profile email"),
|
||||
spritePrefix: z.string().default("paseo-worker-"),
|
||||
defaultRegion: z.string().default(""),
|
||||
defaultRamMB: z.number().int().nonnegative().default(0),
|
||||
@@ -28,6 +38,16 @@ export const flySpritesSettings = defineSettings({
|
||||
export const defaultFlySpritesSettings: FlySpritesSettings = {
|
||||
token: "",
|
||||
baseUrl: "https://api.sprites.dev",
|
||||
openbaoEnabled: true,
|
||||
openbaoAddr: "https://bao.site.latha.org",
|
||||
openbaoAuthMount: "jwt",
|
||||
openbaoRole: "admin",
|
||||
openbaoKvMount: "secret",
|
||||
openbaoSecretPath: "paseo",
|
||||
openbaoSecretKey: "FLY_TOKEN",
|
||||
zitadelIssuer: "https://auth.site.latha.org",
|
||||
zitadelClientId: "400222693598691513",
|
||||
zitadelScope: "openid profile email",
|
||||
spritePrefix: "paseo-worker-",
|
||||
defaultRegion: "",
|
||||
defaultRamMB: 0,
|
||||
|
||||
Reference in new issue
Block a user