@janssenproject/cedarling_wasm 1.8.0-nodejs → 1.9.0-nodejs
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.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.js
CHANGED
|
@@ -235,15 +235,15 @@ function _assertClass(instance, klass) {
|
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
function __wbg_adapter_50(arg0, arg1) {
|
|
238
|
-
wasm.
|
|
238
|
+
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8e11c17984e20636(arg0, arg1);
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
function __wbg_adapter_53(arg0, arg1, arg2) {
|
|
242
|
-
wasm.
|
|
242
|
+
wasm.closure539_externref_shim(arg0, arg1, arg2);
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
function __wbg_adapter_244(arg0, arg1, arg2, arg3) {
|
|
246
|
-
wasm.
|
|
246
|
+
wasm.closure1819_externref_shim(arg0, arg1, arg2, arg3);
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -821,7 +821,7 @@ module.exports.__wbg_cedarling_new = function(arg0) {
|
|
|
821
821
|
return ret;
|
|
822
822
|
};
|
|
823
823
|
|
|
824
|
-
module.exports.
|
|
824
|
+
module.exports.__wbg_clearTimeout_0b53d391c1b94dda = function(arg0) {
|
|
825
825
|
const ret = clearTimeout(arg0);
|
|
826
826
|
return ret;
|
|
827
827
|
};
|
|
@@ -854,7 +854,7 @@ module.exports.__wbg_error_dc53417fcef5463a = function(arg0) {
|
|
|
854
854
|
console.error(...arg0);
|
|
855
855
|
};
|
|
856
856
|
|
|
857
|
-
module.exports.
|
|
857
|
+
module.exports.__wbg_fetch_11bff8299d0ecd2b = function(arg0) {
|
|
858
858
|
const ret = fetch(arg0);
|
|
859
859
|
return ret;
|
|
860
860
|
};
|
|
@@ -1143,7 +1143,7 @@ module.exports.__wbg_resolve_4851785c9c5f573d = function(arg0) {
|
|
|
1143
1143
|
return ret;
|
|
1144
1144
|
};
|
|
1145
1145
|
|
|
1146
|
-
module.exports.
|
|
1146
|
+
module.exports.__wbg_setTimeout_73ce8df12de4f2f2 = function(arg0, arg1) {
|
|
1147
1147
|
const ret = setTimeout(arg0, arg1);
|
|
1148
1148
|
return ret;
|
|
1149
1149
|
};
|
|
@@ -1308,13 +1308,13 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
1308
1308
|
return ret;
|
|
1309
1309
|
};
|
|
1310
1310
|
|
|
1311
|
-
module.exports.
|
|
1312
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1311
|
+
module.exports.__wbindgen_closure_wrapper3866 = function(arg0, arg1, arg2) {
|
|
1312
|
+
const ret = makeMutClosure(arg0, arg1, 495, __wbg_adapter_50);
|
|
1313
1313
|
return ret;
|
|
1314
1314
|
};
|
|
1315
1315
|
|
|
1316
|
-
module.exports.
|
|
1317
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1316
|
+
module.exports.__wbindgen_closure_wrapper4018 = function(arg0, arg1, arg2) {
|
|
1317
|
+
const ret = makeMutClosure(arg0, arg1, 540, __wbg_adapter_53);
|
|
1318
1318
|
return ret;
|
|
1319
1319
|
};
|
|
1320
1320
|
|
package/cedarling_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@janssenproject/cedarling_wasm",
|
|
3
3
|
"description": "The Cedarling is a performant local authorization service that runs the Rust Cedar Engine",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.9.0-nodejs",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|