@zuplo/runtime 5.2288.0 → 5.2290.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.
@@ -170,6 +170,28 @@ export declare interface ApiKeyInboundPolicyOptions {
170
170
  disableAutomaticallyAddingKeyHeaderToOpenApi?: boolean;
171
171
  }
172
172
 
173
+ /**
174
+ * Authentication options for api token authentication.
175
+ */
176
+ declare interface APITokenCredentialConfig {
177
+ /**
178
+ * The type of authentication to use.
179
+ */
180
+ method: "api-token";
181
+ /**
182
+ * The token key to use for authentication.
183
+ */
184
+ token: string;
185
+ /**
186
+ * The name of the header to use for authentication.
187
+ */
188
+ headerName?: string;
189
+ /**
190
+ * The prefix to use for the header value.
191
+ */
192
+ headerValuePrefix?: string;
193
+ }
194
+
173
195
  /**
174
196
  * A list of attributes that will be included in the authorization request.
175
197
  */
@@ -903,6 +925,32 @@ export declare interface ClerkJwtInboundPolicyOptions {
903
925
  frontendApiUrl: string;
904
926
  }
905
927
 
928
+ /**
929
+ * Authentication options for OIDC authentication.
930
+ */
931
+ declare interface ClientCredentialsConfig {
932
+ /**
933
+ * The type of authentication to use.
934
+ */
935
+ method: "client-credentials";
936
+ /**
937
+ * The client ID.
938
+ */
939
+ clientId: string;
940
+ /**
941
+ * The client secret.
942
+ */
943
+ clientSecret: string;
944
+ /**
945
+ * The oauth endpoint url.
946
+ */
947
+ oauthTokenEndpointUrl: string;
948
+ /**
949
+ * API Audience.
950
+ */
951
+ apiAudience?: string;
952
+ }
953
+
906
954
  /**
907
955
  * Authenticate requests with JWT tokens issued by AWS Cognito.
908
956
  *
@@ -1511,6 +1559,20 @@ export declare interface HandlerDefinition {
1511
1559
  options?: unknown;
1512
1560
  }
1513
1561
 
1562
+ /**
1563
+ * Request header authentication.
1564
+ */
1565
+ declare interface HeaderCredentialsConfig {
1566
+ /**
1567
+ * The type of authentication to use.
1568
+ */
1569
+ method: "header";
1570
+ /**
1571
+ * The name of the header to use for authentication.
1572
+ */
1573
+ headerName: string;
1574
+ }
1575
+
1514
1576
  export declare type HttpMethod = "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "CONNECT" | "OPTIONS" | "TRACE" | "PATCH";
1515
1577
 
1516
1578
  /**
@@ -3651,6 +3713,82 @@ declare namespace OpenAPIV3_1 {
3651
3713
  {};
3652
3714
  }
3653
3715
 
3716
+ /**
3717
+ * Authorize requests using OpenFGA.
3718
+ *
3719
+ * @remarks
3720
+ * This policy will authorize requests using OpenFGA. If the
3721
+ * request is not authorized, a 403 response will be returned.
3722
+ *
3723
+ *
3724
+ * @title OpenFGA Authorization Inbound
3725
+ * @beta
3726
+ * @param request - The ZuploRequest
3727
+ * @param context - The ZuploContext
3728
+ * @param options - The policy options set in policies.json
3729
+ * @param policyName - The name of the policy as set in policies.json
3730
+ * @returns A Request or a Response
3731
+ */
3732
+ export declare class OpenFGAAuthZInboundPolicy extends InboundPolicy<OpenFGAAuthZInboundPolicyOptions> {
3733
+ private client;
3734
+ private authorizer;
3735
+ private cache;
3736
+ static setContextChecks(context: ZuploContext, checks: OpenFGACheck | OpenFGACheck[]): void;
3737
+ constructor(options: OpenFGAAuthZInboundPolicyOptions, policyName: string);
3738
+ /**
3739
+ * The handler that is called each time this policy is invoked
3740
+ *
3741
+ * @param request - The incoming Request
3742
+ * @param context - The current context of the Request
3743
+ * @returns A Response or Request object
3744
+ */
3745
+ handler(request: ZuploRequest, context: ZuploContext): Promise<ZuploRequest | Response>;
3746
+ private getAuthorizer;
3747
+ }
3748
+
3749
+ /**
3750
+ * The options for this policy.
3751
+ */
3752
+ export declare interface OpenFGAAuthZInboundPolicyOptions {
3753
+ /**
3754
+ * The URL of the OpenFGA service.
3755
+ */
3756
+ apiUrl: string;
3757
+ /**
3758
+ * The ID of the store.
3759
+ */
3760
+ storeId?: string;
3761
+ /**
3762
+ * The ID of the authorization model.
3763
+ */
3764
+ authorizationModelId?: string;
3765
+ /**
3766
+ * Indicates whether the request should continue if authorization fails. Default is `false` which means unauthorized users will automatically receive a 403 response.
3767
+ */
3768
+ allowUnauthorizedRequests?: boolean;
3769
+ credentials?: UnauthenticatedCredentialConfig | APITokenCredentialConfig | HeaderCredentialsConfig | ClientCredentialsConfig;
3770
+ }
3771
+
3772
+ declare interface OpenFGACheck {
3773
+ /**
3774
+ * The user to check the relation for. If not provided, the user will be set to the request user.
3775
+ */
3776
+ user: string;
3777
+ /**
3778
+ * The relation to check.
3779
+ */
3780
+ relation: string;
3781
+ /**
3782
+ * The object to check the relation for.
3783
+ */
3784
+ object: string;
3785
+ /**
3786
+ * Additional request context that will be used to evaluate any ABAC conditions encountered in the query evaluation.
3787
+ */
3788
+ context?: object;
3789
+ contextualTuples?: Array<TupleKey>;
3790
+ }
3791
+
3654
3792
  /**
3655
3793
  * The Open ID JWT Authentication policy allows you to authenticate incoming requests using an Open ID compliant bearer token.
3656
3794
  *
@@ -4100,6 +4238,26 @@ export declare function ReadmeMetricsInboundPolicy(request: ZuploRequest, contex
4100
4238
  */
4101
4239
  export declare function redirectHandler(request: ZuploRequest, context: ZuploContext): Promise<Response>;
4102
4240
 
4241
+ /**
4242
+ *
4243
+ * @export
4244
+ * @interface RelationshipCondition
4245
+ */
4246
+ declare interface RelationshipCondition {
4247
+ /**
4248
+ * A reference (by name) of the relationship condition defined in the authorization model.
4249
+ * @type {string}
4250
+ * @memberof RelationshipCondition
4251
+ */
4252
+ name: string;
4253
+ /**
4254
+ * Additional context/data to persist along with the condition. The keys must match the parameters defined by the condition, and the value types must match the parameter type definitions.
4255
+ * @type {object}
4256
+ * @memberof RelationshipCondition
4257
+ */
4258
+ context?: object;
4259
+ }
4260
+
4103
4261
  /**
4104
4262
  * Remove headers from the incoming request.
4105
4263
  *
@@ -4873,6 +5031,48 @@ export declare abstract class TelemetryPlugin extends RuntimePlugin {
4873
5031
 
4874
5032
  /* Excluded from this release type: trackFeature */
4875
5033
 
5034
+ /**
5035
+ *
5036
+ * @export
5037
+ * @interface TupleKey
5038
+ */
5039
+ declare interface TupleKey {
5040
+ /**
5041
+ *
5042
+ * @type {string}
5043
+ * @memberof TupleKey
5044
+ */
5045
+ user: string;
5046
+ /**
5047
+ *
5048
+ * @type {string}
5049
+ * @memberof TupleKey
5050
+ */
5051
+ relation: string;
5052
+ /**
5053
+ *
5054
+ * @type {string}
5055
+ * @memberof TupleKey
5056
+ */
5057
+ object: string;
5058
+ /**
5059
+ *
5060
+ * @type {RelationshipCondition}
5061
+ * @memberof TupleKey
5062
+ */
5063
+ condition?: RelationshipCondition;
5064
+ }
5065
+
5066
+ /**
5067
+ * No authentication.
5068
+ */
5069
+ declare interface UnauthenticatedCredentialConfig {
5070
+ /**
5071
+ * The type of authentication to use.
5072
+ */
5073
+ method: "none";
5074
+ }
5075
+
4876
5076
  /**
4877
5077
  * Uses Azure Active Directory to add an Authorization header to the request in order to authenticate requests using Azure identity.
4878
5078
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
- "version": "5.2288.0",
3
+ "version": "5.2290.0",
4
4
  "repository": "https://github.com/zuplo/zuplo",
5
5
  "author": "Zuplo, Inc.",
6
6
  "exports": {