@janssenproject/cedarling_wasm 1.14.0-nodejs → 1.15.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 CHANGED
@@ -89,6 +89,16 @@ export class Cedarling {
89
89
  * makes authorization decision based on the [`Request`]
90
90
  */
91
91
  authorize(request: any): Promise<AuthorizeResult>;
92
+ /**
93
+ * Authorize request for unsigned principals.
94
+ * makes authorization decision based on the [`RequestUnsigned`]
95
+ */
96
+ authorize_unsigned(request: any): Promise<AuthorizeResult>;
97
+ /**
98
+ * Authorize multi-issuer request.
99
+ * Makes authorization decision based on multiple JWT tokens from different issuers
100
+ */
101
+ authorize_multi_issuer(request: any): Promise<MultiIssuerAuthorizeResult>;
92
102
  /**
93
103
  * Get logs and remove them from the storage.
94
104
  * Returns `Array` of `Map`
@@ -139,6 +149,10 @@ export class AuthorizeResult {
139
149
  * Result of authorization where principal is `Jans::User`
140
150
  */
141
151
  person?: AuthorizeResultResponse;
152
+ /**
153
+ * Get result for a specific principal
154
+ */
155
+ principal(principal: string): AuthorizeResultResponse | undefined;
142
156
  /**
143
157
  * Result of authorization
144
158
  * true means `ALLOW`
@@ -153,6 +167,31 @@ export class AuthorizeResult {
153
167
  request_id: string;
154
168
  }
155
169
 
170
+ /**
171
+ * A WASM wrapper for the Rust `cedarling::MultiIssuerAuthorizeResult` struct.
172
+ * Represents the result of a multi-issuer authorization request.
173
+ */
174
+ export class MultiIssuerAuthorizeResult {
175
+ /**
176
+ * Convert `MultiIssuerAuthorizeResult` to json string value
177
+ */
178
+ json_string(): string;
179
+ /**
180
+ * Result of Cedar policy authorization
181
+ */
182
+ response: AuthorizeResultResponse;
183
+ /**
184
+ * Result of authorization
185
+ * true means `ALLOW`
186
+ * false means `Deny`
187
+ */
188
+ decision: boolean;
189
+ /**
190
+ * Request ID of the authorization request
191
+ */
192
+ request_id: string;
193
+ }
194
+
156
195
  /**
157
196
  * A WASM wrapper for the Rust `cedar_policy::Response` struct.
158
197
  * Represents the result of an authorization request.
@@ -1,14 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Create a new instance of the Cedarling application.
5
- * This function can take as config parameter the eather `Map` other `Object`
6
- */
7
- export function init(config: any): Promise<Cedarling>;
8
- /**
9
- * A WASM wrapper for the Rust `cedarling::AuthorizeResult` struct.
10
- * Represents the result of an authorization request.
11
- */
3
+
12
4
  export class AuthorizeResult {
13
5
  private constructor();
14
6
  free(): void;
@@ -47,10 +39,7 @@ export class AuthorizeResult {
47
39
  */
48
40
  request_id: string;
49
41
  }
50
- /**
51
- * A WASM wrapper for the Rust `cedar_policy::Response` struct.
52
- * Represents the result of an authorization request.
53
- */
42
+
54
43
  export class AuthorizeResultResponse {
55
44
  private constructor();
56
45
  free(): void;
@@ -64,9 +53,7 @@ export class AuthorizeResultResponse {
64
53
  */
65
54
  readonly diagnostics: Diagnostics;
66
55
  }
67
- /**
68
- * The instance of the Cedarling application.
69
- */
56
+
70
57
  export class Cedarling {
71
58
  private constructor();
72
59
  free(): void;
@@ -91,6 +78,11 @@ export class Cedarling {
91
78
  * makes authorization decision based on the [`RequestUnsigned`]
92
79
  */
93
80
  authorize_unsigned(request: any): Promise<AuthorizeResult>;
81
+ /**
82
+ * Authorize multi-issuer request.
83
+ * Makes authorization decision based on multiple JWT tokens from different issuers
84
+ */
85
+ authorize_multi_issuer(request: any): Promise<MultiIssuerAuthorizeResult>;
94
86
  /**
95
87
  * Get logs and remove them from the storage.
96
88
  * Returns `Array` of `Map`
@@ -127,12 +119,7 @@ export class Cedarling {
127
119
  */
128
120
  shut_down(): Promise<void>;
129
121
  }
130
- /**
131
- * Diagnostics
132
- * ===========
133
- *
134
- * Provides detailed information about how a policy decision was made, including policies that contributed to the decision and any errors encountered during evaluation.
135
- */
122
+
136
123
  export class Diagnostics {
137
124
  private constructor();
138
125
  free(): void;
@@ -150,18 +137,38 @@ export class Diagnostics {
150
137
  */
151
138
  readonly errors: PolicyEvaluationError[];
152
139
  }
140
+
153
141
  export class JsJsonLogic {
154
142
  free(): void;
155
143
  [Symbol.dispose](): void;
156
144
  constructor();
157
145
  apply(logic: any, data: any): any;
158
146
  }
159
- /**
160
- * PolicyEvaluationError
161
- * =====================
162
- *
163
- * Represents an error that occurred when evaluating a Cedar policy.
164
- */
147
+
148
+ export class MultiIssuerAuthorizeResult {
149
+ private constructor();
150
+ free(): void;
151
+ [Symbol.dispose](): void;
152
+ /**
153
+ * Convert `MultiIssuerAuthorizeResult` to json string value
154
+ */
155
+ json_string(): string;
156
+ /**
157
+ * Result of Cedar policy authorization
158
+ */
159
+ response: AuthorizeResultResponse;
160
+ /**
161
+ * Result of authorization
162
+ * true means `ALLOW`
163
+ * false means `Deny`
164
+ */
165
+ decision: boolean;
166
+ /**
167
+ * Request ID of the authorization request
168
+ */
169
+ request_id: string;
170
+ }
171
+
165
172
  export class PolicyEvaluationError {
166
173
  private constructor();
167
174
  free(): void;
@@ -175,3 +182,9 @@ export class PolicyEvaluationError {
175
182
  */
176
183
  readonly error: string;
177
184
  }
185
+
186
+ /**
187
+ * Create a new instance of the Cedarling application.
188
+ * This function can take as config parameter the eather `Map` other `Object`
189
+ */
190
+ export function init(config: any): Promise<Cedarling>;