mirror of
https://github.com/logto-io/logto.git
synced 2025-01-13 21:30:30 -05:00
chore: add Cloudflare worker config for custom JWT (#5709)
This commit is contained in:
parent
622e003a49
commit
1b4c106603
1 changed files with 20 additions and 0 deletions
|
@ -165,16 +165,35 @@ export const protectedAppConfigProviderDataGuard = z.object({
|
||||||
|
|
||||||
export type ProtectedAppConfigProviderData = z.infer<typeof protectedAppConfigProviderDataGuard>;
|
export type ProtectedAppConfigProviderData = z.infer<typeof protectedAppConfigProviderDataGuard>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cloudflare workers config for custom JWT.
|
||||||
|
* Ref: https://developers.cloudflare.com/api/
|
||||||
|
*/
|
||||||
|
export const customJwtWorkerConfigGuard = z.object({
|
||||||
|
/** Cloudflare API Key (api_key). */
|
||||||
|
apiKey: z.string(),
|
||||||
|
/** Cloudflare API Key (api_email). */
|
||||||
|
apiEmail: z.string(),
|
||||||
|
/** Cloudflare account ID. */
|
||||||
|
accountId: z.string(),
|
||||||
|
/** Default Cloudflare subdomain for the account. */
|
||||||
|
subdomain: z.string(),
|
||||||
|
});
|
||||||
|
|
||||||
|
export type CustomJwtWorkerConfig = z.infer<typeof customJwtWorkerConfigGuard>;
|
||||||
|
|
||||||
export enum CloudflareKey {
|
export enum CloudflareKey {
|
||||||
HostnameProvider = 'cloudflareHostnameProvider',
|
HostnameProvider = 'cloudflareHostnameProvider',
|
||||||
ProtectedAppConfigProvider = 'cloudflareProtectedAppConfigProvider',
|
ProtectedAppConfigProvider = 'cloudflareProtectedAppConfigProvider',
|
||||||
ProtectedAppHostnameProvider = 'cloudflareProtectedAppHostnameProvider',
|
ProtectedAppHostnameProvider = 'cloudflareProtectedAppHostnameProvider',
|
||||||
|
CustomJwtWorkerConfig = 'cloudflareCustomJwtWorkerConfig',
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CloudflareType = {
|
export type CloudflareType = {
|
||||||
[CloudflareKey.HostnameProvider]: HostnameProviderData;
|
[CloudflareKey.HostnameProvider]: HostnameProviderData;
|
||||||
[CloudflareKey.ProtectedAppConfigProvider]: ProtectedAppConfigProviderData;
|
[CloudflareKey.ProtectedAppConfigProvider]: ProtectedAppConfigProviderData;
|
||||||
[CloudflareKey.ProtectedAppHostnameProvider]: HostnameProviderData;
|
[CloudflareKey.ProtectedAppHostnameProvider]: HostnameProviderData;
|
||||||
|
[CloudflareKey.CustomJwtWorkerConfig]: CustomJwtWorkerConfig;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const cloudflareGuard: Readonly<{
|
export const cloudflareGuard: Readonly<{
|
||||||
|
@ -183,6 +202,7 @@ export const cloudflareGuard: Readonly<{
|
||||||
[CloudflareKey.HostnameProvider]: hostnameProviderDataGuard,
|
[CloudflareKey.HostnameProvider]: hostnameProviderDataGuard,
|
||||||
[CloudflareKey.ProtectedAppConfigProvider]: protectedAppConfigProviderDataGuard,
|
[CloudflareKey.ProtectedAppConfigProvider]: protectedAppConfigProviderDataGuard,
|
||||||
[CloudflareKey.ProtectedAppHostnameProvider]: hostnameProviderDataGuard,
|
[CloudflareKey.ProtectedAppHostnameProvider]: hostnameProviderDataGuard,
|
||||||
|
[CloudflareKey.CustomJwtWorkerConfig]: customJwtWorkerConfigGuard,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Summary
|
// Summary
|
||||||
|
|
Loading…
Add table
Reference in a new issue