@janssenproject/cedarling_wasm 1.8.0 → 1.9.0
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 +43 -12
- package/cedarling_wasm.d.ts +3 -3
- package/cedarling_wasm.js +10 -10
- package/cedarling_wasm_bg.wasm +0 -0
- package/package.json +1 -1
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
|
-
|
|
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
|
-
|
|
50
|
-
|
|
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
|
-
|
|
53
|
-
|
|
52
|
+
async function main() {
|
|
53
|
+
await initWasm(); // Initialize the WebAssembly module
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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:
|
|
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:
|
|
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
|
+
```
|
package/cedarling_wasm.d.ts
CHANGED
|
@@ -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
|
|
224
|
-
readonly
|
|
225
|
-
readonly
|
|
223
|
+
readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8e11c17984e20636: (a: number, b: number) => void;
|
|
224
|
+
readonly closure539_externref_shim: (a: number, b: number, c: any) => void;
|
|
225
|
+
readonly closure1819_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.
|
|
234
|
+
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8e11c17984e20636(arg0, arg1);
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
function __wbg_adapter_53(arg0, arg1, arg2) {
|
|
238
|
-
wasm.
|
|
238
|
+
wasm.closure539_externref_shim(arg0, arg1, arg2);
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
function __wbg_adapter_244(arg0, arg1, arg2, arg3) {
|
|
242
|
-
wasm.
|
|
242
|
+
wasm.closure1819_externref_shim(arg0, arg1, arg2, arg3);
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -835,7 +835,7 @@ function __wbg_get_imports() {
|
|
|
835
835
|
const ret = Cedarling.__wrap(arg0);
|
|
836
836
|
return ret;
|
|
837
837
|
};
|
|
838
|
-
imports.wbg.
|
|
838
|
+
imports.wbg.__wbg_clearTimeout_0b53d391c1b94dda = function(arg0) {
|
|
839
839
|
const ret = clearTimeout(arg0);
|
|
840
840
|
return ret;
|
|
841
841
|
};
|
|
@@ -861,7 +861,7 @@ function __wbg_get_imports() {
|
|
|
861
861
|
imports.wbg.__wbg_error_dc53417fcef5463a = function(arg0) {
|
|
862
862
|
console.error(...arg0);
|
|
863
863
|
};
|
|
864
|
-
imports.wbg.
|
|
864
|
+
imports.wbg.__wbg_fetch_11bff8299d0ecd2b = function(arg0) {
|
|
865
865
|
const ret = fetch(arg0);
|
|
866
866
|
return ret;
|
|
867
867
|
};
|
|
@@ -1100,7 +1100,7 @@ function __wbg_get_imports() {
|
|
|
1100
1100
|
const ret = Promise.resolve(arg0);
|
|
1101
1101
|
return ret;
|
|
1102
1102
|
};
|
|
1103
|
-
imports.wbg.
|
|
1103
|
+
imports.wbg.__wbg_setTimeout_73ce8df12de4f2f2 = function(arg0, arg1) {
|
|
1104
1104
|
const ret = setTimeout(arg0, arg1);
|
|
1105
1105
|
return ret;
|
|
1106
1106
|
};
|
|
@@ -1232,12 +1232,12 @@ function __wbg_get_imports() {
|
|
|
1232
1232
|
const ret = false;
|
|
1233
1233
|
return ret;
|
|
1234
1234
|
};
|
|
1235
|
-
imports.wbg.
|
|
1236
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1235
|
+
imports.wbg.__wbindgen_closure_wrapper3866 = function(arg0, arg1, arg2) {
|
|
1236
|
+
const ret = makeMutClosure(arg0, arg1, 495, __wbg_adapter_50);
|
|
1237
1237
|
return ret;
|
|
1238
1238
|
};
|
|
1239
|
-
imports.wbg.
|
|
1240
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1239
|
+
imports.wbg.__wbindgen_closure_wrapper4018 = function(arg0, arg1, arg2) {
|
|
1240
|
+
const ret = makeMutClosure(arg0, arg1, 540, __wbg_adapter_53);
|
|
1241
1241
|
return ret;
|
|
1242
1242
|
};
|
|
1243
1243
|
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
package/cedarling_wasm_bg.wasm
CHANGED
|
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": "1.
|
|
5
|
+
"version": "1.9.0",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|