@zuplo/runtime 5.2493.0 → 5.2495.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.
@@ -164,6 +164,72 @@ declare interface APITokenCredentialConfig {
164
164
  headerValuePrefix?: string;
165
165
  }
166
166
 
167
+ /**
168
+ * Authorize requests using Aserto.
169
+ *
170
+ * @title Aserto Authorization
171
+ * @beta
172
+ * @param request - The ZuploRequest
173
+ * @param context - The ZuploContext
174
+ * @param options - The policy options set in policies.json
175
+ * @param policyName - The name of the policy as set in policies.json
176
+ * @returns A Request or a Response
177
+ */
178
+ export declare class AsertoAuthZInboundPolicy extends InboundPolicy<AsertoAuthZInboundPolicyOptions> {
179
+ private cache;
180
+ private authorizationUrl;
181
+ static setAuthorizationContext(context: ZuploContext, asertoContext: AsertoContext): void;
182
+ constructor(options: AsertoAuthZInboundPolicyOptions, policyName: string);
183
+ /**
184
+ * The handler that is called each time this policy is invoked
185
+ *
186
+ * @param request - The incoming Request
187
+ * @param context - The current context of the Request
188
+ * @returns A Response or Request object
189
+ */
190
+ handler(request: ZuploRequest, context: ZuploContext): Promise<ZuploRequest | Response>;
191
+ }
192
+
193
+ /**
194
+ * The options for this policy.
195
+ */
196
+ export declare interface AsertoAuthZInboundPolicyOptions {
197
+ /**
198
+ * Indicates whether the request should continue if authorization fails. Default is `false` which means unauthorized users will automatically receive a 403 response.
199
+ */
200
+ allowUnauthorizedRequests?: boolean;
201
+ /**
202
+ * The Aserto Tenant ID.
203
+ */
204
+ tenantId: string;
205
+ /**
206
+ * The Aserto API key.
207
+ */
208
+ authorizerApiKey: string;
209
+ /**
210
+ * The Aserto Authorizer API URL.
211
+ */
212
+ authorizerApiUrl?: string;
213
+ /**
214
+ * The name of the Asserto policy to use for authorization.
215
+ */
216
+ authorizerPolicyName?: string;
217
+ /**
218
+ * Canonicalized service name (required unless all the overrides below are provided).
219
+ */
220
+ serviceName?: string;
221
+ }
222
+
223
+ declare interface AsertoContext {
224
+ identity_context: {
225
+ identity: string;
226
+ type: "IDENTITY_TYPE_SUB" | "IDENTITY_TYPE_NONE" | "IDENTITY_TYPE_JWT";
227
+ };
228
+ policy_context: PolicyContext;
229
+ policy_instance: PolicyInstance;
230
+ resource_context: ResourceContext;
231
+ }
232
+
167
233
  /**
168
234
  * A list of attributes that will be included in the authorization request.
169
235
  */
@@ -3871,6 +3937,16 @@ export declare interface PolicyConfiguration {
3871
3937
  options?: unknown;
3872
3938
  }
3873
3939
 
3940
+ declare interface PolicyContext {
3941
+ decisions: string[];
3942
+ path: string;
3943
+ }
3944
+
3945
+ declare interface PolicyInstance {
3946
+ name: string;
3947
+ instance_label: string;
3948
+ }
3949
+
3874
3950
  declare type Primitive = null | undefined | string | number | boolean | symbol | bigint;
3875
3951
 
3876
3952
  /**
@@ -4468,6 +4544,8 @@ declare type ResolveRequestQuery<TQuery extends RequestQueryDefault | undefined>
4468
4544
 
4469
4545
  declare type ResolveUserData<TUserData extends UserDataDefault | undefined> = TUserData extends UserDataDefault ? TUserData : UserDataDefault;
4470
4546
 
4547
+ declare type ResourceContext = Record<string, string>;
4548
+
4471
4549
  /**
4472
4550
  * @beta
4473
4551
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "5.2493.0",
4
+ "version": "5.2495.0",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {