@kustodian/plugin-authelia 1.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ import type { KustodianPluginType } from '@kustodian/plugins';
2
+ /**
3
+ * Creates the Authelia plugin.
4
+ */
5
+ export declare function create_authelia_plugin(options?: Record<string, unknown>): KustodianPluginType;
6
+ /**
7
+ * Default plugin export.
8
+ */
9
+ export declare const plugin: KustodianPluginType;
10
+ export default plugin;
11
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAKV,mBAAmB,EAIpB,MAAM,oBAAoB,CAAC;AA4G5B;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,mBAAmB,CAkPjG;AAED;;GAEG;AACH,eAAO,MAAM,MAAM,qBAA2B,CAAC;AAE/C,eAAe,MAAM,CAAC"}
@@ -0,0 +1,442 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Authelia access control policy types
4
+ */
5
+ export declare const authelia_policy_schema: z.ZodEnum<["bypass", "one_factor", "two_factor", "deny"]>;
6
+ export type AutheliaPolicyType = z.infer<typeof authelia_policy_schema>;
7
+ /**
8
+ * Authelia PKCE challenge method
9
+ */
10
+ export declare const pkce_challenge_method_schema: z.ZodEnum<["plain", "S256"]>;
11
+ export type PKCEChallengeMethodType = z.infer<typeof pkce_challenge_method_schema>;
12
+ /**
13
+ * Authelia token endpoint auth method
14
+ */
15
+ export declare const token_endpoint_auth_method_schema: z.ZodEnum<["client_secret_basic", "client_secret_post", "client_secret_jwt", "private_key_jwt", "none"]>;
16
+ export type TokenEndpointAuthMethodType = z.infer<typeof token_endpoint_auth_method_schema>;
17
+ /**
18
+ * Authelia consent mode
19
+ */
20
+ export declare const consent_mode_schema: z.ZodEnum<["explicit", "implicit", "pre-configured"]>;
21
+ export type ConsentModeType = z.infer<typeof consent_mode_schema>;
22
+ /**
23
+ * Authentication provider types supported by the plugin
24
+ */
25
+ export declare const auth_provider_schema: z.ZodEnum<["oidc", "proxy", "header"]>;
26
+ export type AuthProviderType = z.infer<typeof auth_provider_schema>;
27
+ /**
28
+ * OIDC client configuration for Authelia
29
+ */
30
+ export declare const oidc_client_config_schema: z.ZodObject<{
31
+ /** Unique client identifier */
32
+ client_id: z.ZodString;
33
+ /** Display name for the client */
34
+ client_name: z.ZodOptional<z.ZodString>;
35
+ /** Client secret (will be hashed) */
36
+ client_secret: z.ZodOptional<z.ZodString>;
37
+ /** Whether this is a public client (no secret) */
38
+ public: z.ZodDefault<z.ZodBoolean>;
39
+ /** Authorization policy (default: two_factor) */
40
+ authorization_policy: z.ZodDefault<z.ZodEnum<["bypass", "one_factor", "two_factor", "deny"]>>;
41
+ /** Require PKCE for authorization code flow */
42
+ require_pkce: z.ZodDefault<z.ZodBoolean>;
43
+ /** PKCE challenge method */
44
+ pkce_challenge_method: z.ZodDefault<z.ZodEnum<["plain", "S256"]>>;
45
+ /** Redirect URIs for OAuth callbacks */
46
+ redirect_uris: z.ZodArray<z.ZodString, "many">;
47
+ /** Scopes to grant (default: openid, profile, email, groups) */
48
+ scopes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
49
+ /** Response types (default: code) */
50
+ response_types: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
51
+ /** Grant types (default: authorization_code) */
52
+ grant_types: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
53
+ /** Token endpoint authentication method */
54
+ token_endpoint_auth_method: z.ZodDefault<z.ZodEnum<["client_secret_basic", "client_secret_post", "client_secret_jwt", "private_key_jwt", "none"]>>;
55
+ /** Consent mode */
56
+ consent_mode: z.ZodOptional<z.ZodEnum<["explicit", "implicit", "pre-configured"]>>;
57
+ /** Pre-configured consent duration (e.g., '1 week') */
58
+ pre_configured_consent_duration: z.ZodOptional<z.ZodString>;
59
+ /** Audience for the client */
60
+ audience: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
61
+ /** Additional Authelia client options */
62
+ additional_options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
63
+ }, "strip", z.ZodTypeAny, {
64
+ client_id: string;
65
+ public: boolean;
66
+ authorization_policy: "bypass" | "one_factor" | "two_factor" | "deny";
67
+ require_pkce: boolean;
68
+ pkce_challenge_method: "plain" | "S256";
69
+ redirect_uris: string[];
70
+ scopes: string[];
71
+ response_types: string[];
72
+ grant_types: string[];
73
+ token_endpoint_auth_method: "client_secret_basic" | "client_secret_post" | "client_secret_jwt" | "private_key_jwt" | "none";
74
+ client_name?: string | undefined;
75
+ client_secret?: string | undefined;
76
+ consent_mode?: "explicit" | "implicit" | "pre-configured" | undefined;
77
+ pre_configured_consent_duration?: string | undefined;
78
+ audience?: string[] | undefined;
79
+ additional_options?: Record<string, unknown> | undefined;
80
+ }, {
81
+ client_id: string;
82
+ redirect_uris: string[];
83
+ client_name?: string | undefined;
84
+ client_secret?: string | undefined;
85
+ public?: boolean | undefined;
86
+ authorization_policy?: "bypass" | "one_factor" | "two_factor" | "deny" | undefined;
87
+ require_pkce?: boolean | undefined;
88
+ pkce_challenge_method?: "plain" | "S256" | undefined;
89
+ scopes?: string[] | undefined;
90
+ response_types?: string[] | undefined;
91
+ grant_types?: string[] | undefined;
92
+ token_endpoint_auth_method?: "client_secret_basic" | "client_secret_post" | "client_secret_jwt" | "private_key_jwt" | "none" | undefined;
93
+ consent_mode?: "explicit" | "implicit" | "pre-configured" | undefined;
94
+ pre_configured_consent_duration?: string | undefined;
95
+ audience?: string[] | undefined;
96
+ additional_options?: Record<string, unknown> | undefined;
97
+ }>;
98
+ export type OIDCClientConfigType = z.infer<typeof oidc_client_config_schema>;
99
+ /**
100
+ * Access control rule configuration for Authelia
101
+ */
102
+ export declare const access_control_rule_schema: z.ZodObject<{
103
+ /** Domain(s) to match */
104
+ domain: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
105
+ /** Domain regex pattern (alternative to domain) */
106
+ domain_regex: z.ZodOptional<z.ZodString>;
107
+ /** Policy to apply */
108
+ policy: z.ZodEnum<["bypass", "one_factor", "two_factor", "deny"]>;
109
+ /** Networks to match */
110
+ networks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
111
+ /** Subject(s) to match (users/groups) */
112
+ subject: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodArray<z.ZodString, "many">, "many">]>>;
113
+ /** HTTP methods to match */
114
+ methods: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
115
+ /** Resource patterns to match */
116
+ resources: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
117
+ /** Query parameter conditions */
118
+ query: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">, "many">>;
119
+ }, "strip", z.ZodTypeAny, {
120
+ domain: string | string[];
121
+ policy: "bypass" | "one_factor" | "two_factor" | "deny";
122
+ domain_regex?: string | undefined;
123
+ networks?: string[] | undefined;
124
+ subject?: string | string[] | string[][] | undefined;
125
+ methods?: string[] | undefined;
126
+ resources?: string[] | undefined;
127
+ query?: Record<string, unknown>[][] | undefined;
128
+ }, {
129
+ domain: string | string[];
130
+ policy: "bypass" | "one_factor" | "two_factor" | "deny";
131
+ domain_regex?: string | undefined;
132
+ networks?: string[] | undefined;
133
+ subject?: string | string[] | string[][] | undefined;
134
+ methods?: string[] | undefined;
135
+ resources?: string[] | undefined;
136
+ query?: Record<string, unknown>[][] | undefined;
137
+ }>;
138
+ export type AccessControlRuleType = z.infer<typeof access_control_rule_schema>;
139
+ /**
140
+ * Proxy/Forward Auth configuration
141
+ */
142
+ export declare const proxy_auth_config_schema: z.ZodObject<{
143
+ /** External host for the application */
144
+ external_host: z.ZodString;
145
+ /** Internal service host */
146
+ internal_host: z.ZodString;
147
+ /** Paths to skip authentication */
148
+ skip_path_regex: z.ZodOptional<z.ZodString>;
149
+ /** Access control policy */
150
+ policy: z.ZodDefault<z.ZodEnum<["bypass", "one_factor", "two_factor", "deny"]>>;
151
+ /** Allowed networks */
152
+ networks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
153
+ /** Allowed subjects (users/groups) */
154
+ subject: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
155
+ }, "strip", z.ZodTypeAny, {
156
+ policy: "bypass" | "one_factor" | "two_factor" | "deny";
157
+ external_host: string;
158
+ internal_host: string;
159
+ networks?: string[] | undefined;
160
+ subject?: string | string[] | undefined;
161
+ skip_path_regex?: string | undefined;
162
+ }, {
163
+ external_host: string;
164
+ internal_host: string;
165
+ policy?: "bypass" | "one_factor" | "two_factor" | "deny" | undefined;
166
+ networks?: string[] | undefined;
167
+ subject?: string | string[] | undefined;
168
+ skip_path_regex?: string | undefined;
169
+ }>;
170
+ export type ProxyAuthConfigType = z.infer<typeof proxy_auth_config_schema>;
171
+ /**
172
+ * Authentication configuration in template kustomizations
173
+ */
174
+ export declare const auth_config_schema: z.ZodObject<{
175
+ /** Authentication provider type */
176
+ provider: z.ZodEnum<["oidc", "proxy", "header"]>;
177
+ /** Application name (used as client_id for OIDC) */
178
+ app_name: z.ZodString;
179
+ /** Display name for the application */
180
+ app_display_name: z.ZodOptional<z.ZodString>;
181
+ /** Application description */
182
+ app_description: z.ZodOptional<z.ZodString>;
183
+ /** Application icon URL */
184
+ app_icon: z.ZodOptional<z.ZodString>;
185
+ /** Application group/category */
186
+ app_group: z.ZodOptional<z.ZodString>;
187
+ /** Application launch URL */
188
+ app_launch_url: z.ZodOptional<z.ZodString>;
189
+ /** External host (for proxy/access control) */
190
+ external_host: z.ZodOptional<z.ZodString>;
191
+ /** Internal service host (for proxy) */
192
+ internal_host: z.ZodOptional<z.ZodString>;
193
+ /** OIDC-specific configuration */
194
+ oidc: z.ZodOptional<z.ZodObject<{
195
+ client_id: z.ZodOptional<z.ZodString>;
196
+ client_name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
197
+ client_secret: z.ZodOptional<z.ZodOptional<z.ZodString>>;
198
+ public: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
199
+ authorization_policy: z.ZodOptional<z.ZodDefault<z.ZodEnum<["bypass", "one_factor", "two_factor", "deny"]>>>;
200
+ require_pkce: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
201
+ pkce_challenge_method: z.ZodOptional<z.ZodDefault<z.ZodEnum<["plain", "S256"]>>>;
202
+ redirect_uris: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
203
+ scopes: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
204
+ response_types: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
205
+ grant_types: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
206
+ token_endpoint_auth_method: z.ZodOptional<z.ZodDefault<z.ZodEnum<["client_secret_basic", "client_secret_post", "client_secret_jwt", "private_key_jwt", "none"]>>>;
207
+ consent_mode: z.ZodOptional<z.ZodOptional<z.ZodEnum<["explicit", "implicit", "pre-configured"]>>>;
208
+ pre_configured_consent_duration: z.ZodOptional<z.ZodOptional<z.ZodString>>;
209
+ audience: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
210
+ additional_options: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
211
+ }, "strip", z.ZodTypeAny, {
212
+ client_id?: string | undefined;
213
+ client_name?: string | undefined;
214
+ client_secret?: string | undefined;
215
+ public?: boolean | undefined;
216
+ authorization_policy?: "bypass" | "one_factor" | "two_factor" | "deny" | undefined;
217
+ require_pkce?: boolean | undefined;
218
+ pkce_challenge_method?: "plain" | "S256" | undefined;
219
+ redirect_uris?: string[] | undefined;
220
+ scopes?: string[] | undefined;
221
+ response_types?: string[] | undefined;
222
+ grant_types?: string[] | undefined;
223
+ token_endpoint_auth_method?: "client_secret_basic" | "client_secret_post" | "client_secret_jwt" | "private_key_jwt" | "none" | undefined;
224
+ consent_mode?: "explicit" | "implicit" | "pre-configured" | undefined;
225
+ pre_configured_consent_duration?: string | undefined;
226
+ audience?: string[] | undefined;
227
+ additional_options?: Record<string, unknown> | undefined;
228
+ }, {
229
+ client_id?: string | undefined;
230
+ client_name?: string | undefined;
231
+ client_secret?: string | undefined;
232
+ public?: boolean | undefined;
233
+ authorization_policy?: "bypass" | "one_factor" | "two_factor" | "deny" | undefined;
234
+ require_pkce?: boolean | undefined;
235
+ pkce_challenge_method?: "plain" | "S256" | undefined;
236
+ redirect_uris?: string[] | undefined;
237
+ scopes?: string[] | undefined;
238
+ response_types?: string[] | undefined;
239
+ grant_types?: string[] | undefined;
240
+ token_endpoint_auth_method?: "client_secret_basic" | "client_secret_post" | "client_secret_jwt" | "private_key_jwt" | "none" | undefined;
241
+ consent_mode?: "explicit" | "implicit" | "pre-configured" | undefined;
242
+ pre_configured_consent_duration?: string | undefined;
243
+ audience?: string[] | undefined;
244
+ additional_options?: Record<string, unknown> | undefined;
245
+ }>>;
246
+ /** Proxy-specific configuration */
247
+ proxy: z.ZodOptional<z.ZodObject<{
248
+ external_host: z.ZodOptional<z.ZodString>;
249
+ internal_host: z.ZodOptional<z.ZodString>;
250
+ skip_path_regex: z.ZodOptional<z.ZodOptional<z.ZodString>>;
251
+ policy: z.ZodOptional<z.ZodDefault<z.ZodEnum<["bypass", "one_factor", "two_factor", "deny"]>>>;
252
+ networks: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
253
+ subject: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>>;
254
+ }, "strip", z.ZodTypeAny, {
255
+ policy?: "bypass" | "one_factor" | "two_factor" | "deny" | undefined;
256
+ networks?: string[] | undefined;
257
+ subject?: string | string[] | undefined;
258
+ external_host?: string | undefined;
259
+ internal_host?: string | undefined;
260
+ skip_path_regex?: string | undefined;
261
+ }, {
262
+ policy?: "bypass" | "one_factor" | "two_factor" | "deny" | undefined;
263
+ networks?: string[] | undefined;
264
+ subject?: string | string[] | undefined;
265
+ external_host?: string | undefined;
266
+ internal_host?: string | undefined;
267
+ skip_path_regex?: string | undefined;
268
+ }>>;
269
+ /** Custom access control rules */
270
+ access_control: z.ZodOptional<z.ZodArray<z.ZodObject<{
271
+ /** Domain(s) to match */
272
+ domain: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
273
+ /** Domain regex pattern (alternative to domain) */
274
+ domain_regex: z.ZodOptional<z.ZodString>;
275
+ /** Policy to apply */
276
+ policy: z.ZodEnum<["bypass", "one_factor", "two_factor", "deny"]>;
277
+ /** Networks to match */
278
+ networks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
279
+ /** Subject(s) to match (users/groups) */
280
+ subject: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodArray<z.ZodString, "many">, "many">]>>;
281
+ /** HTTP methods to match */
282
+ methods: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
283
+ /** Resource patterns to match */
284
+ resources: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
285
+ /** Query parameter conditions */
286
+ query: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">, "many">>;
287
+ }, "strip", z.ZodTypeAny, {
288
+ domain: string | string[];
289
+ policy: "bypass" | "one_factor" | "two_factor" | "deny";
290
+ domain_regex?: string | undefined;
291
+ networks?: string[] | undefined;
292
+ subject?: string | string[] | string[][] | undefined;
293
+ methods?: string[] | undefined;
294
+ resources?: string[] | undefined;
295
+ query?: Record<string, unknown>[][] | undefined;
296
+ }, {
297
+ domain: string | string[];
298
+ policy: "bypass" | "one_factor" | "two_factor" | "deny";
299
+ domain_regex?: string | undefined;
300
+ networks?: string[] | undefined;
301
+ subject?: string | string[] | string[][] | undefined;
302
+ methods?: string[] | undefined;
303
+ resources?: string[] | undefined;
304
+ query?: Record<string, unknown>[][] | undefined;
305
+ }>, "many">>;
306
+ }, "strip", z.ZodTypeAny, {
307
+ provider: "oidc" | "proxy" | "header";
308
+ app_name: string;
309
+ oidc?: {
310
+ client_id?: string | undefined;
311
+ client_name?: string | undefined;
312
+ client_secret?: string | undefined;
313
+ public?: boolean | undefined;
314
+ authorization_policy?: "bypass" | "one_factor" | "two_factor" | "deny" | undefined;
315
+ require_pkce?: boolean | undefined;
316
+ pkce_challenge_method?: "plain" | "S256" | undefined;
317
+ redirect_uris?: string[] | undefined;
318
+ scopes?: string[] | undefined;
319
+ response_types?: string[] | undefined;
320
+ grant_types?: string[] | undefined;
321
+ token_endpoint_auth_method?: "client_secret_basic" | "client_secret_post" | "client_secret_jwt" | "private_key_jwt" | "none" | undefined;
322
+ consent_mode?: "explicit" | "implicit" | "pre-configured" | undefined;
323
+ pre_configured_consent_duration?: string | undefined;
324
+ audience?: string[] | undefined;
325
+ additional_options?: Record<string, unknown> | undefined;
326
+ } | undefined;
327
+ proxy?: {
328
+ policy?: "bypass" | "one_factor" | "two_factor" | "deny" | undefined;
329
+ networks?: string[] | undefined;
330
+ subject?: string | string[] | undefined;
331
+ external_host?: string | undefined;
332
+ internal_host?: string | undefined;
333
+ skip_path_regex?: string | undefined;
334
+ } | undefined;
335
+ external_host?: string | undefined;
336
+ internal_host?: string | undefined;
337
+ app_display_name?: string | undefined;
338
+ app_description?: string | undefined;
339
+ app_icon?: string | undefined;
340
+ app_group?: string | undefined;
341
+ app_launch_url?: string | undefined;
342
+ access_control?: {
343
+ domain: string | string[];
344
+ policy: "bypass" | "one_factor" | "two_factor" | "deny";
345
+ domain_regex?: string | undefined;
346
+ networks?: string[] | undefined;
347
+ subject?: string | string[] | string[][] | undefined;
348
+ methods?: string[] | undefined;
349
+ resources?: string[] | undefined;
350
+ query?: Record<string, unknown>[][] | undefined;
351
+ }[] | undefined;
352
+ }, {
353
+ provider: "oidc" | "proxy" | "header";
354
+ app_name: string;
355
+ oidc?: {
356
+ client_id?: string | undefined;
357
+ client_name?: string | undefined;
358
+ client_secret?: string | undefined;
359
+ public?: boolean | undefined;
360
+ authorization_policy?: "bypass" | "one_factor" | "two_factor" | "deny" | undefined;
361
+ require_pkce?: boolean | undefined;
362
+ pkce_challenge_method?: "plain" | "S256" | undefined;
363
+ redirect_uris?: string[] | undefined;
364
+ scopes?: string[] | undefined;
365
+ response_types?: string[] | undefined;
366
+ grant_types?: string[] | undefined;
367
+ token_endpoint_auth_method?: "client_secret_basic" | "client_secret_post" | "client_secret_jwt" | "private_key_jwt" | "none" | undefined;
368
+ consent_mode?: "explicit" | "implicit" | "pre-configured" | undefined;
369
+ pre_configured_consent_duration?: string | undefined;
370
+ audience?: string[] | undefined;
371
+ additional_options?: Record<string, unknown> | undefined;
372
+ } | undefined;
373
+ proxy?: {
374
+ policy?: "bypass" | "one_factor" | "two_factor" | "deny" | undefined;
375
+ networks?: string[] | undefined;
376
+ subject?: string | string[] | undefined;
377
+ external_host?: string | undefined;
378
+ internal_host?: string | undefined;
379
+ skip_path_regex?: string | undefined;
380
+ } | undefined;
381
+ external_host?: string | undefined;
382
+ internal_host?: string | undefined;
383
+ app_display_name?: string | undefined;
384
+ app_description?: string | undefined;
385
+ app_icon?: string | undefined;
386
+ app_group?: string | undefined;
387
+ app_launch_url?: string | undefined;
388
+ access_control?: {
389
+ domain: string | string[];
390
+ policy: "bypass" | "one_factor" | "two_factor" | "deny";
391
+ domain_regex?: string | undefined;
392
+ networks?: string[] | undefined;
393
+ subject?: string | string[] | string[][] | undefined;
394
+ methods?: string[] | undefined;
395
+ resources?: string[] | undefined;
396
+ query?: Record<string, unknown>[][] | undefined;
397
+ }[] | undefined;
398
+ }>;
399
+ export type AuthConfigType = z.infer<typeof auth_config_schema>;
400
+ /**
401
+ * Authelia plugin options
402
+ */
403
+ export declare const authelia_plugin_options_schema: z.ZodObject<{
404
+ /** Authelia domain (e.g., auth.example.com) */
405
+ domain: z.ZodOptional<z.ZodString>;
406
+ /** Default authorization policy */
407
+ default_policy: z.ZodDefault<z.ZodEnum<["bypass", "one_factor", "two_factor", "deny"]>>;
408
+ /** Secret hashing algorithm (for client secrets) */
409
+ hash_algorithm: z.ZodDefault<z.ZodEnum<["pbkdf2", "argon2"]>>;
410
+ /** Whether to generate client secrets automatically */
411
+ auto_generate_secrets: z.ZodDefault<z.ZodBoolean>;
412
+ /** Output directory for generated configurations */
413
+ output_dir: z.ZodDefault<z.ZodString>;
414
+ }, "strip", z.ZodTypeAny, {
415
+ default_policy: "bypass" | "one_factor" | "two_factor" | "deny";
416
+ hash_algorithm: "pbkdf2" | "argon2";
417
+ auto_generate_secrets: boolean;
418
+ output_dir: string;
419
+ domain?: string | undefined;
420
+ }, {
421
+ domain?: string | undefined;
422
+ default_policy?: "bypass" | "one_factor" | "two_factor" | "deny" | undefined;
423
+ hash_algorithm?: "pbkdf2" | "argon2" | undefined;
424
+ auto_generate_secrets?: boolean | undefined;
425
+ output_dir?: string | undefined;
426
+ }>;
427
+ export type AutheliaPluginOptionsType = z.infer<typeof authelia_plugin_options_schema>;
428
+ /**
429
+ * Generated Authelia configuration
430
+ */
431
+ export interface AutheliaConfigType {
432
+ identity_providers?: {
433
+ oidc?: {
434
+ clients?: OIDCClientConfigType[];
435
+ };
436
+ };
437
+ access_control?: {
438
+ default_policy?: AutheliaPolicyType;
439
+ rules?: AccessControlRuleType[];
440
+ };
441
+ }
442
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,sBAAsB,2DAAyD,CAAC;AAC7F,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OA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AEvF;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,kBAAkB,CAAC,EAAE;QACnB,IAAI,CAAC,EAAE;YACL,OAAO,CAAC,EAAE,oBAAoB,EAAE,CAAC;SAClC,CAAC;KACH,CAAC;IACF,cAAc,CAAC,EAAE;QACf,cAAc,CAAC,EAAE,kBAAkB,CAAC;QACpC,KAAK,CAAC,EAAE,qBAAqB,EAAE,CAAC;KACjC,CAAC;CACH"}
package/package.json CHANGED
@@ -1,23 +1,34 @@
1
1
  {
2
2
  "name": "@kustodian/plugin-authelia",
3
- "version": "1.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Authelia authentication provider plugin for Kustodian",
5
5
  "type": "module",
6
- "main": "./src/index.ts",
7
- "types": "./src/index.ts",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
- "types": "./src/index.ts",
11
- "import": "./src/index.ts"
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
12
  }
13
13
  },
14
- "files": ["src"],
14
+ "files": [
15
+ "dist"
16
+ ],
15
17
  "scripts": {
16
18
  "test": "bun test",
17
19
  "test:watch": "bun test --watch",
18
- "typecheck": "bun run tsc --noEmit"
20
+ "typecheck": "bun run tsc --noEmit",
21
+ "build": "bun build src/index.ts --outdir dist --target node --format esm && tsc --emitDeclarationOnly --outDir dist",
22
+ "prepublishOnly": "bun run build"
19
23
  },
20
- "keywords": ["kustodian", "plugin", "authelia", "authentication", "oidc", "kubernetes"],
24
+ "keywords": [
25
+ "kustodian",
26
+ "plugin",
27
+ "authelia",
28
+ "authentication",
29
+ "oidc",
30
+ "kubernetes"
31
+ ],
21
32
  "author": "Luca Silverentand <luca@onezero.company>",
22
33
  "license": "MIT",
23
34
  "repository": {
@@ -26,16 +37,16 @@
26
37
  "directory": "plugins/authelia"
27
38
  },
28
39
  "publishConfig": {
29
- "registry": "https://npm.pkg.github.com"
40
+ "access": "public",
41
+ "registry": "https://registry.npmjs.org"
30
42
  },
31
43
  "dependencies": {
32
- "@kustodian/core": "^1.1.0",
33
- "@kustodian/plugins": "^1.0.1",
34
- "@kustodian/schema": "^1.2.0",
35
- "js-yaml": "^4.1.1",
36
- "zod": "^4.3.5"
44
+ "@kustodian/core": "2.0.0",
45
+ "@kustodian/plugins": "2.0.0",
46
+ "@kustodian/schema": "2.0.0",
47
+ "js-yaml": "^4.1.0",
48
+ "zod": "^3.25.30"
37
49
  },
38
- "packageManager": "pnpm@10.19.0",
39
50
  "devDependencies": {
40
51
  "@types/js-yaml": "^4.0.9"
41
52
  }
package/src/executor.ts DELETED
@@ -1,114 +0,0 @@
1
- import { exec } from 'node:child_process';
2
- import { promisify } from 'node:util';
3
- import { type KustodianErrorType, type ResultType, create_error, success } from '@kustodian/core';
4
-
5
- const exec_async = promisify(exec);
6
-
7
- /**
8
- * Check if authelia CLI is available
9
- */
10
- export async function check_authelia_available(): Promise<ResultType<string, KustodianErrorType>> {
11
- try {
12
- const { stdout } = await exec_async('authelia --version', { timeout: 5000 });
13
- const version = stdout.trim();
14
- return success(version);
15
- } catch (error) {
16
- return {
17
- success: false,
18
- error: create_error(
19
- 'AUTHELIA_CLI_NOT_FOUND',
20
- 'Authelia CLI not found. Install from: https://www.authelia.com/integration/deployment/installation/',
21
- error,
22
- ),
23
- };
24
- }
25
- }
26
-
27
- /**
28
- * Generate a hashed password using Authelia CLI
29
- * @param password - Plain text password to hash
30
- * @param algorithm - Hashing algorithm (pbkdf2 or argon2)
31
- */
32
- export async function hash_password(
33
- password: string,
34
- algorithm: 'pbkdf2' | 'argon2' = 'pbkdf2',
35
- ): Promise<ResultType<string, KustodianErrorType>> {
36
- try {
37
- const cmd =
38
- algorithm === 'argon2'
39
- ? `authelia crypto hash generate argon2 --password '${password}'`
40
- : `authelia crypto hash generate pbkdf2 --password '${password}'`;
41
-
42
- const { stdout } = await exec_async(cmd, { timeout: 10000 });
43
-
44
- // Extract the hash from output (format: "Digest: $hash...")
45
- const hash_match = stdout.match(/Digest: (.+)/);
46
- if (!hash_match?.[1]) {
47
- return {
48
- success: false,
49
- error: create_error(
50
- 'AUTHELIA_HASH_GENERATION_FAILED',
51
- 'Failed to extract hash from authelia output',
52
- ),
53
- };
54
- }
55
-
56
- return success(hash_match[1].trim());
57
- } catch (error) {
58
- return {
59
- success: false,
60
- error: create_error(
61
- 'AUTHELIA_HASH_GENERATION_FAILED',
62
- `Failed to hash password: ${error instanceof Error ? error.message : String(error)}`,
63
- error,
64
- ),
65
- };
66
- }
67
- }
68
-
69
- /**
70
- * Generate a random secret suitable for OIDC client secrets
71
- */
72
- export async function generate_random_secret(
73
- length = 64,
74
- ): Promise<ResultType<string, KustodianErrorType>> {
75
- try {
76
- const { stdout } = await exec_async(
77
- `authelia crypto rand --length ${length} --charset alphanumeric`,
78
- {
79
- timeout: 5000,
80
- },
81
- );
82
- return success(stdout.trim());
83
- } catch (error) {
84
- return {
85
- success: false,
86
- error: create_error(
87
- 'AUTHELIA_SECRET_GENERATION_FAILED',
88
- `Failed to generate random secret: ${error instanceof Error ? error.message : String(error)}`,
89
- error,
90
- ),
91
- };
92
- }
93
- }
94
-
95
- /**
96
- * Validate access control configuration using Authelia CLI
97
- */
98
- export async function validate_access_control(
99
- config_path: string,
100
- ): Promise<ResultType<boolean, KustodianErrorType>> {
101
- try {
102
- await exec_async(`authelia validate-config ${config_path}`, { timeout: 10000 });
103
- return success(true);
104
- } catch (error) {
105
- return {
106
- success: false,
107
- error: create_error(
108
- 'AUTHELIA_CONFIG_VALIDATION_FAILED',
109
- `Configuration validation failed: ${error instanceof Error ? error.message : String(error)}`,
110
- error,
111
- ),
112
- };
113
- }
114
- }