@janssenproject/cedarling_wasm 0.0.148 → 0.0.149

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/README.md CHANGED
@@ -37,7 +37,7 @@ To run example using `index.html` you need execute following steps:
37
37
  1. Build wasm cedarling.
38
38
  2. Run webserver using `python3 -m http.server` or any other.
39
39
  3. Visit example app [localhost](http://localhost:8000/), on this app you will get log in browser console.
40
- - Also you can try use cedarling with web app using [cedarling_app](http://localhost:8000/cedarling_app.html), using custom bootstrap properties and request.
40
+ - Also you can try use cedarling with web app using [cedarling_app](http://localhost:8000/cedarling_app.html), using custom bootstrap properties and request.
41
41
 
42
42
  ## WASM Usage
43
43
 
@@ -46,17 +46,17 @@ After building WASM bindings in folder `pkg` you can find where you can find `ce
46
46
  In `index.html` described simple usage of `cedarling wasm` API:
47
47
 
48
48
  ```js
49
- import { BOOTSTRAP_CONFIG, REQUEST } from "/example_data.js" // Import js objects: bootstrap config and request
50
- import initWasm, { init } from "/pkg/cedarling_wasm.js";
49
+ import { BOOTSTRAP_CONFIG, REQUEST } from "/example_data.js"; // Import js objects: bootstrap config and request
50
+ import initWasm, { init } from "/pkg/cedarling_wasm.js";
51
51
 
52
- async function main() {
53
- await initWasm(); // Initialize the WebAssembly module
52
+ async function main() {
53
+ await initWasm(); // Initialize the WebAssembly module
54
54
 
55
- let instance = await init(BOOTSTRAP_CONFIG);
56
- let result = await instance.authorize(REQUEST);
57
- console.log("result:", result);
58
- }
59
- main().catch(console.error);
55
+ let instance = await init(BOOTSTRAP_CONFIG);
56
+ let result = await instance.authorize(REQUEST);
57
+ console.log("result:", result);
58
+ }
59
+ main().catch(console.error);
60
60
  ```
61
61
 
62
62
  Before using any function from library you need initialize WASM runtime by calling `initWasm` function.
@@ -181,12 +181,12 @@ export class Diagnostics {
181
181
  *
182
182
  * The ids should be treated as unordered,
183
183
  */
184
- readonly reason: (string)[];
184
+ readonly reason: string[];
185
185
  /**
186
186
  * Errors that occurred during authorization. The errors should be
187
187
  * treated as unordered, since policies may be evaluated in any order.
188
188
  */
189
- readonly errors: (PolicyEvaluationError)[];
189
+ readonly errors: PolicyEvaluationError[];
190
190
  }
191
191
 
192
192
  /**
@@ -206,3 +206,34 @@ export class PolicyEvaluationError {
206
206
  readonly error: string;
207
207
  }
208
208
  ```
209
+
210
+ ## Configuration
211
+
212
+ ### ID Token Trust Mode
213
+
214
+ The `CEDARLING_ID_TOKEN_TRUST_MODE` property controls how ID tokens are validated:
215
+
216
+ - **`strict`** (default): Enforces strict validation rules
217
+ - ID token `aud` must match access token `client_id`
218
+ - If userinfo token is present, its `sub` must match the ID token `sub`
219
+ - **`never`**: Disables ID token validation (useful for testing)
220
+ - **`always`**: Always validates ID tokens when present
221
+ - **`ifpresent`**: Validates ID tokens only if they are provided
222
+
223
+ ### Testing Configuration
224
+
225
+ For testing scenarios, you may want to disable JWT validation. You can configure this in your bootstrap configuration:
226
+
227
+ ```javascript
228
+ const BOOTSTRAP_CONFIG = {
229
+ CEDARLING_JWT_SIG_VALIDATION: "disabled",
230
+ CEDARLING_JWT_STATUS_VALIDATION: "disabled",
231
+ CEDARLING_ID_TOKEN_TRUST_MODE: "never",
232
+ };
233
+ ```
234
+
235
+ For complete configuration documentation, see [cedarling-properties.md](../../../docs/cedarling/cedarling-properties.md).
236
+
237
+ ```
238
+
239
+ ```
@@ -220,9 +220,9 @@ export interface InitOutput {
220
220
  readonly __externref_table_dealloc: (a: number) => void;
221
221
  readonly __externref_drop_slice: (a: number, b: number) => void;
222
222
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
223
- readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf597e8206f12bf34: (a: number, b: number) => void;
224
- readonly closure519_externref_shim: (a: number, b: number, c: any) => void;
225
- readonly closure1792_externref_shim: (a: number, b: number, c: any, d: any) => void;
223
+ readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__he69c46427d921ca8: (a: number, b: number) => void;
224
+ readonly closure516_externref_shim: (a: number, b: number, c: any) => void;
225
+ readonly closure1795_externref_shim: (a: number, b: number, c: any, d: any) => void;
226
226
  readonly __wbindgen_start: () => void;
227
227
  }
228
228
 
package/cedarling_wasm.js CHANGED
@@ -231,15 +231,15 @@ function _assertClass(instance, klass) {
231
231
  }
232
232
  }
233
233
  function __wbg_adapter_50(arg0, arg1) {
234
- wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf597e8206f12bf34(arg0, arg1);
234
+ wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__he69c46427d921ca8(arg0, arg1);
235
235
  }
236
236
 
237
237
  function __wbg_adapter_53(arg0, arg1, arg2) {
238
- wasm.closure519_externref_shim(arg0, arg1, arg2);
238
+ wasm.closure516_externref_shim(arg0, arg1, arg2);
239
239
  }
240
240
 
241
241
  function __wbg_adapter_244(arg0, arg1, arg2, arg3) {
242
- wasm.closure1792_externref_shim(arg0, arg1, arg2, arg3);
242
+ wasm.closure1795_externref_shim(arg0, arg1, arg2, arg3);
243
243
  }
244
244
 
245
245
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -1232,12 +1232,12 @@ function __wbg_get_imports() {
1232
1232
  const ret = false;
1233
1233
  return ret;
1234
1234
  };
1235
- imports.wbg.__wbindgen_closure_wrapper3698 = function(arg0, arg1, arg2) {
1236
- const ret = makeMutClosure(arg0, arg1, 472, __wbg_adapter_50);
1235
+ imports.wbg.__wbindgen_closure_wrapper3670 = function(arg0, arg1, arg2) {
1236
+ const ret = makeMutClosure(arg0, arg1, 470, __wbg_adapter_50);
1237
1237
  return ret;
1238
1238
  };
1239
- imports.wbg.__wbindgen_closure_wrapper3850 = function(arg0, arg1, arg2) {
1240
- const ret = makeMutClosure(arg0, arg1, 520, __wbg_adapter_53);
1239
+ imports.wbg.__wbindgen_closure_wrapper3822 = function(arg0, arg1, arg2) {
1240
+ const ret = makeMutClosure(arg0, arg1, 517, __wbg_adapter_53);
1241
1241
  return ret;
1242
1242
  };
1243
1243
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@janssenproject/cedarling_wasm",
3
3
  "type": "module",
4
4
  "description": "The Cedarling is a performant local authorization service that runs the Rust Cedar Engine",
5
- "version": "0.0.148",
5
+ "version": "0.0.149",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",