@aifabrix/builder 2.1.1 → 2.1.2

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.
package/lib/generator.js CHANGED
@@ -124,10 +124,19 @@ function buildBaseDeployment(appName, variables, filteredConfiguration) {
124
124
  function buildAuthenticationConfig(variables, rbac) {
125
125
  if (variables.authentication) {
126
126
  const auth = {
127
- type: variables.authentication.type || 'azure',
128
- enableSSO: variables.authentication.enableSSO !== undefined ? variables.authentication.enableSSO : true,
129
- requiredRoles: variables.authentication.requiredRoles || []
127
+ enableSSO: variables.authentication.enableSSO !== undefined ? variables.authentication.enableSSO : true
130
128
  };
129
+
130
+ // When enableSSO is false, default type to 'none' and requiredRoles to []
131
+ // When enableSSO is true, require type and requiredRoles
132
+ if (auth.enableSSO === false) {
133
+ auth.type = variables.authentication.type || 'none';
134
+ auth.requiredRoles = variables.authentication.requiredRoles || [];
135
+ } else {
136
+ auth.type = variables.authentication.type || 'azure';
137
+ auth.requiredRoles = variables.authentication.requiredRoles || [];
138
+ }
139
+
131
140
  if (variables.authentication.endpoints) {
132
141
  auth.endpoints = variables.authentication.endpoints;
133
142
  }
@@ -474,5 +483,6 @@ module.exports = {
474
483
  buildImageReference,
475
484
  buildHealthCheck,
476
485
  buildRequirements,
477
- buildAuthentication
486
+ buildAuthentication,
487
+ buildAuthenticationConfig
478
488
  };
@@ -428,8 +428,8 @@
428
428
  },
429
429
  "authentication": {
430
430
  "type": "object",
431
- "description": "Authentication configuration",
432
- "required": ["type", "enableSSO", "requiredRoles"],
431
+ "description": "Authentication configuration. When enableSSO is false, only enableSSO is required. When enableSSO is true, type and requiredRoles are also required.",
432
+ "required": ["enableSSO"],
433
433
  "properties": {
434
434
  "type": {
435
435
  "type": "string",
@@ -466,7 +466,21 @@
466
466
  "additionalProperties": false
467
467
  }
468
468
  },
469
- "additionalProperties": false
469
+ "additionalProperties": false,
470
+ "allOf": [
471
+ {
472
+ "if": {
473
+ "properties": {
474
+ "enableSSO": {
475
+ "const": true
476
+ }
477
+ }
478
+ },
479
+ "then": {
480
+ "required": ["type", "enableSSO", "requiredRoles"]
481
+ }
482
+ }
483
+ ]
470
484
  },
471
485
  "roles": {
472
486
  "type": "array",
@@ -55,6 +55,23 @@ function transformFlatStructure(variables, appName) {
55
55
  type: sanitizeAuthType(result.authentication.type)
56
56
  };
57
57
  }
58
+ // Handle partial authentication objects (when only enableSSO is provided)
59
+ if (result.authentication && result.authentication.enableSSO !== undefined) {
60
+ const auth = {
61
+ ...result.authentication,
62
+ enableSSO: result.authentication.enableSSO
63
+ };
64
+ // When enableSSO is false, default type to 'none' and requiredRoles to []
65
+ // When enableSSO is true, default type to 'azure' if not provided
66
+ if (auth.enableSSO === false) {
67
+ auth.type = sanitizeAuthType(result.authentication.type || 'none');
68
+ auth.requiredRoles = result.authentication.requiredRoles || [];
69
+ } else {
70
+ auth.type = sanitizeAuthType(result.authentication.type || 'azure');
71
+ auth.requiredRoles = result.authentication.requiredRoles || [];
72
+ }
73
+ result.authentication = auth;
74
+ }
58
75
 
59
76
  return result;
60
77
  }
@@ -182,10 +199,24 @@ function transformOptionalFields(variables, transformed) {
182
199
  }
183
200
 
184
201
  if (variables.authentication) {
185
- transformed.authentication = {
202
+ // Ensure authentication object has enableSSO at minimum
203
+ // Default type and requiredRoles based on enableSSO value
204
+ const auth = {
186
205
  ...variables.authentication,
187
- type: sanitizeAuthType(variables.authentication.type)
206
+ enableSSO: variables.authentication.enableSSO !== undefined ? variables.authentication.enableSSO : true
188
207
  };
208
+
209
+ // When enableSSO is false, default type to 'none' and requiredRoles to []
210
+ // When enableSSO is true, default type to 'azure' if not provided
211
+ if (auth.enableSSO === false) {
212
+ auth.type = sanitizeAuthType(variables.authentication.type || 'none');
213
+ auth.requiredRoles = variables.authentication.requiredRoles || [];
214
+ } else {
215
+ auth.type = sanitizeAuthType(variables.authentication.type || 'azure');
216
+ auth.requiredRoles = variables.authentication.requiredRoles || [];
217
+ }
218
+
219
+ transformed.authentication = auth;
189
220
  }
190
221
 
191
222
  const repository = validateRepositoryConfig(variables.repository);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aifabrix/builder",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "AI Fabrix Local Fabric & Deployment SDK",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -34,11 +34,7 @@ healthCheck:
34
34
 
35
35
  # Authentication
36
36
  authentication:
37
- type: keycloak
38
- enableSSO: true
39
- requiredRoles: ["aifabrix-user"]
40
- endpoints:
41
- local: "http://localhost:8082/auth/callback"
37
+ enableSSO: false
42
38
 
43
39
  # Build Configuration
44
40
  build:
@@ -1,37 +0,0 @@
1
- roles:
2
- - name: "AI Fabrix Admin"
3
- value: "aifabrix-admin"
4
- description: "Full access to all application features and configurations"
5
-
6
- - name: "AI Fabrix User"
7
- value: "aifabrix-user"
8
- description: "Basic user access to the application"
9
-
10
- - name: "AI Fabrix Developer"
11
- value: "aifabrix-developer"
12
- description: "Developer access for testing and debugging"
13
-
14
- permissions:
15
- - name: "myapp:read"
16
- roles:
17
- - "aifabrix-user"
18
- - "aifabrix-admin"
19
- - "aifabrix-developer"
20
- description: "Read access to application data"
21
-
22
- - name: "myapp:write"
23
- roles:
24
- - "aifabrix-admin"
25
- - "aifabrix-developer"
26
- description: "Create and edit application data"
27
-
28
- - name: "myapp:delete"
29
- roles:
30
- - "aifabrix-admin"
31
- description: "Delete application data"
32
-
33
- - name: "myapp:admin"
34
- roles:
35
- - "aifabrix-admin"
36
- description: "Administrative access to application configuration"
37
-