-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec58031
commit 3d0fe3d
Showing
16 changed files
with
1,311 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,3 +46,13 @@ format license-check lint test: ci | |
|
||
doc: | ||
cd lib && npm run doc | ||
|
||
toolcheck: | ||
@echo "Checking for required tools..." | ||
@which buf > /dev/null || (echo "buf not found, please install it from https://docs.buf.build/installation" && exit 1) | ||
@which protoc-gen-grpc-gateway-ts > /dev/null || (echo "protoc-gen-grpc-gateway-ts not found, run 'go install github.com/grpc-ecosystem/[email protected]'" && exit 1) | ||
@golangci-lint --version | grep "version v\?1.5[67]" > /dev/null || (echo "golangci-lint version must be v1.55 [$$(golangci-lint --version)]" && exit 1) | ||
|
||
proto-generate: | ||
rm -rf lib/proto | ||
buf generate https://github.com/opentdf/platform.git\#branch\=main,subdir\=service --exclude-path authorization/idp_plugin.proto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: v1 | ||
managed: | ||
enabled: false | ||
plugins: | ||
- plugin: grpc-gateway-ts | ||
out: lib/proto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* eslint-disable */ | ||
// @ts-nocheck | ||
/* | ||
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY | ||
*/ | ||
|
||
import * as fm from "../fetch.pb" | ||
import * as GoogleProtobufAny from "../google/protobuf/any.pb" | ||
import * as PolicyObjects from "../policy/objects.pb" | ||
|
||
type Absent<T, K extends keyof T> = { [k in Exclude<keyof T, K>]?: undefined }; | ||
type OneOf<T> = | ||
| { [k in keyof T]?: undefined } | ||
| ( | ||
keyof T extends infer K ? | ||
(K extends string & keyof T ? { [k in K]: T[K] } & Absent<T, K> | ||
: never) | ||
: never); | ||
|
||
export enum DecisionResponseDecision { | ||
DECISION_UNSPECIFIED = "DECISION_UNSPECIFIED", | ||
DECISION_DENY = "DECISION_DENY", | ||
DECISION_PERMIT = "DECISION_PERMIT", | ||
} | ||
|
||
|
||
type BaseEntity = { | ||
id?: string | ||
} | ||
|
||
export type Entity = BaseEntity | ||
& OneOf<{ emailAddress: string; userName: string; remoteClaimsUrl: string; jwt: string; claims: GoogleProtobufAny.Any; custom: EntityCustom; clientId: string }> | ||
|
||
export type EntityCustom = { | ||
extension?: GoogleProtobufAny.Any | ||
} | ||
|
||
export type EntityChain = { | ||
id?: string | ||
entities?: Entity[] | ||
} | ||
|
||
export type DecisionRequest = { | ||
actions?: PolicyObjects.Action[] | ||
entityChains?: EntityChain[] | ||
resourceAttributes?: ResourceAttribute[] | ||
} | ||
|
||
export type DecisionResponse = { | ||
entityChainId?: string | ||
resourceAttributesId?: string | ||
action?: PolicyObjects.Action | ||
decision?: DecisionResponseDecision | ||
obligations?: string[] | ||
} | ||
|
||
export type GetDecisionsRequest = { | ||
decisionRequests?: DecisionRequest[] | ||
} | ||
|
||
export type GetDecisionsResponse = { | ||
decisionResponses?: DecisionResponse[] | ||
} | ||
|
||
|
||
type BaseGetEntitlementsRequest = { | ||
entities?: Entity[] | ||
} | ||
|
||
export type GetEntitlementsRequest = BaseGetEntitlementsRequest | ||
& OneOf<{ scope: ResourceAttribute }> | ||
|
||
export type EntityEntitlements = { | ||
entityId?: string | ||
attributeValueFqns?: string[] | ||
} | ||
|
||
export type ResourceAttribute = { | ||
attributeValueFqns?: string[] | ||
} | ||
|
||
export type GetEntitlementsResponse = { | ||
entitlements?: EntityEntitlements[] | ||
} | ||
|
||
export class AuthorizationService { | ||
static GetDecisions(req: GetDecisionsRequest, initReq?: fm.InitReq): Promise<GetDecisionsResponse> { | ||
return fm.fetchReq<GetDecisionsRequest, GetDecisionsResponse>(`/v1/authorization`, {...initReq, method: "POST"}) | ||
} | ||
static GetEntitlements(req: GetEntitlementsRequest, initReq?: fm.InitReq): Promise<GetEntitlementsResponse> { | ||
return fm.fetchReq<GetEntitlementsRequest, GetEntitlementsResponse>(`/v1/entitlements`, {...initReq, method: "POST"}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* eslint-disable */ | ||
// @ts-nocheck | ||
/* | ||
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY | ||
*/ | ||
|
||
import * as GoogleProtobufTimestamp from "../google/protobuf/timestamp.pb" | ||
|
||
export enum MetadataUpdateEnum { | ||
METADATA_UPDATE_ENUM_UNSPECIFIED = "METADATA_UPDATE_ENUM_UNSPECIFIED", | ||
METADATA_UPDATE_ENUM_EXTEND = "METADATA_UPDATE_ENUM_EXTEND", | ||
METADATA_UPDATE_ENUM_REPLACE = "METADATA_UPDATE_ENUM_REPLACE", | ||
} | ||
|
||
export enum ActiveStateEnum { | ||
ACTIVE_STATE_ENUM_UNSPECIFIED = "ACTIVE_STATE_ENUM_UNSPECIFIED", | ||
ACTIVE_STATE_ENUM_ACTIVE = "ACTIVE_STATE_ENUM_ACTIVE", | ||
ACTIVE_STATE_ENUM_INACTIVE = "ACTIVE_STATE_ENUM_INACTIVE", | ||
ACTIVE_STATE_ENUM_ANY = "ACTIVE_STATE_ENUM_ANY", | ||
} | ||
|
||
export type Metadata = { | ||
createdAt?: GoogleProtobufTimestamp.Timestamp | ||
updatedAt?: GoogleProtobufTimestamp.Timestamp | ||
labels?: {[key: string]: string} | ||
} | ||
|
||
export type MetadataMutable = { | ||
labels?: {[key: string]: string} | ||
} |
Oops, something went wrong.