Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e840509
add state to ERD and add new migration
jakedoublev Feb 12, 2024
0f36899
add real uuids to fixtures for readability
jakedoublev Feb 12, 2024
971d063
fix namespaces GET and LIST queries to only return id and name but no…
jakedoublev Feb 12, 2024
9b4f973
add indexes on state column
jakedoublev Feb 12, 2024
0e7de50
Merge branch 'main' into issue-96/state
jakedoublev Feb 12, 2024
6b2e38c
add state to namespaces fixtures
jakedoublev Feb 12, 2024
60ef44a
add function and trigger definitions to new migration sql
jakedoublev Feb 12, 2024
a866acc
add soft-delete to namespaces, then support list filtering based on s…
jakedoublev Feb 12, 2024
b6e71ef
prove out triggers working as expected in update cascade from namespaces
jakedoublev Feb 12, 2024
312cd40
demonstrate it can still be found when inactive
jakedoublev Feb 12, 2024
091bd29
add state enum to namespaces, attributes, attribute values protos and…
jakedoublev Feb 14, 2024
b762b6e
generated sdk code from protos
jakedoublev Feb 14, 2024
77a2d4e
add support for state in the db functions that message handlers call
jakedoublev Feb 14, 2024
c9f3a76
add debug logs, clean up naming from soft-delete to deactivation, mak…
jakedoublev Feb 14, 2024
faf14f5
cleanup
jakedoublev Feb 15, 2024
f4dbba3
cleanup
jakedoublev Feb 15, 2024
bbee6b9
rename schema ERD files and preserve timestamped schemas per migration
jakedoublev Feb 15, 2024
592d14e
update proto state type active enum, regenerate protos, and match gen…
jakedoublev Feb 16, 2024
09cc5df
Merge branch 'main' into issue-96/state
jakedoublev Feb 16, 2024
cf2981c
use Tables struct and fields provided instead of tableField func for …
jakedoublev Feb 16, 2024
9e8238e
remove unused tableField func
jakedoublev Feb 16, 2024
fe83e1a
Merge branch 'main' into issue-96/state
jakedoublev Feb 16, 2024
de308d6
change state enum to active bool column in schema migration/erd
jakedoublev Feb 16, 2024
45263de
allow clients to use a string enum active/inactive/any/unspecified in…
jakedoublev Feb 16, 2024
5c07e8c
add more integration tests, update tests, and add deactivated state t…
jakedoublev Feb 16, 2024
22af346
Merge branch 'main' into issue-96/state
jakedoublev Feb 16, 2024
28a6092
Merge branch 'main' into issue-96/state
jakedoublev Feb 16, 2024
18cf018
update protos and generated code
jakedoublev Feb 16, 2024
4e334e6
handle active response as boolean
jakedoublev Feb 16, 2024
c080c4e
update example grpcurls to reflect new response active field instead …
jakedoublev Feb 16, 2024
44a0af1
introduced google protobuf boolean wrapper to handle marshaling false…
jakedoublev Feb 16, 2024
388d6eb
consume wrapper type for active state
jakedoublev Feb 16, 2024
2905053
fix tests to account for new bool wrapper and make sure to scan into …
jakedoublev Feb 16, 2024
7ca58bc
Merge branch 'main' into issue-96/state
jakedoublev Feb 16, 2024
d80f19b
Merge branch 'main' into issue-96/state
jrschumacher Feb 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,626 changes: 2,146 additions & 1,480 deletions docs/grpc/index.html

Large diffs are not rendered by default.

839 changes: 839 additions & 0 deletions docs/openapi/attributes/attributes.swagger.json

Large diffs are not rendered by default.

312 changes: 312 additions & 0 deletions docs/openapi/authorization/authorization.swagger.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,312 @@
{
"swagger": "2.0",
"info": {
"title": "authorization/authorization.proto",
"version": "version not set"
},
"tags": [
{
"name": "AuthorizationService"
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/v1/authorization": {
"post": {
"operationId": "AuthorizationService_GetDecisions",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/authorizationGetDecisionsResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"tags": [
"AuthorizationService"
]
}
},
"/v1/entitlements": {
"post": {
"operationId": "AuthorizationService_GetEntitlements",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/authorizationGetEntitlementsResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "scope.id",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "scope.attributeId",
"in": "query",
"required": false,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "multi"
}
],
"tags": [
"AuthorizationService"
]
}
}
},
"definitions": {
"ActionStandardAction": {
"type": "string",
"enum": [
"STANDARD_ACTION_UNSPECIFIED",
"STANDARD_ACTION_DECRYPT",
"STANDARD_ACTION_TRANSMIT"
],
"default": "STANDARD_ACTION_UNSPECIFIED",
"title": "Standard actions supported by the platform"
},
"DecisionResponseDecision": {
"type": "string",
"enum": [
"DECISION_UNSPECIFIED",
"DECISION_DENY",
"DECISION_PERMIT"
],
"default": "DECISION_UNSPECIFIED"
},
"authorizationAction": {
"type": "object",
"properties": {
"standard": {
"$ref": "#/definitions/ActionStandardAction"
},
"custom": {
"type": "string"
}
},
"title": "An action an entity can take"
},
"authorizationDecisionRequest": {
"type": "object",
"properties": {
"actions": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/authorizationAction"
}
},
"entityChains": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/authorizationEntityChain"
}
},
"resourceAttributes": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/authorizationResourceAttributes"
}
}
},
"description": "{\n\"actions\": [\n{\n\"standard\": \"STANDARD_ACTION_TRANSMIT\"\n}\n],\n\"entityChains\": [\n{\n\"id\": \"ec1\",\n\"entities\": [\n{\n\"emailAddress\": \"[email protected]\"\n}\n]\n},\n{\n\"id\": \"ec2\",\n\"entities\": [\n{\n\"userName\": \"[email protected]\"\n}\n]\n}\n],\n\"resourceAttributes\": [\n{\n\"id\": \"attr-set-1\",\n\"attributeValueReferences\": [\n{\n\"attributeFqn\": \"http://www.example.org/attr/foo/value/bar\"\n}\n]\n},\n{\n\"id\": \"request-set-2\",\n\"attributeValueReferences\": [\n{\n\"attributeFqn\": \"http://www.example.org/attr/foo/value/bar\"\n},\n{\n\"attributeFqn\": \"http://www.example.org/attr/color/value/red\"\n}\n]\n}\n]\n}",
"title": "Example Request Get Decisions to answer the question - Do Bob (represented by entity chain ec1)\nand Alice (represented by entity chain ec2) have TRANSMIT authorization for\n2 resources; resource1 (attr-set-1) defined by attributes foo:bar resource2 (attr-set-2) defined by attribute foo:bar, color:red ?"
},
"authorizationDecisionResponse": {
"type": "object",
"properties": {
"entityChainId": {
"type": "string",
"title": "ephemeral entity chain id from the request"
},
"resourceAttributesId": {
"type": "string",
"title": "ephemeral resource attributes id from the request"
},
"action": {
"$ref": "#/definitions/authorizationAction",
"title": "Action of the decision response"
},
"decision": {
"$ref": "#/definitions/DecisionResponseDecision",
"title": "The decision response"
},
"obligations": {
"type": "array",
"items": {
"type": "string"
},
"title": "optional list of obligations represented in URI format"
}
},
"description": "Results:\n- bob has permitted authorization to transmit for a resource defined by attr-set-1 attributes and has a watermark obligation\n- bob has denied authorization to transmit a for a resource defined by attr-set-2 attributes\n- alice has permitted authorization to transmit for a resource defined by attr-set-1 attributes\n- alice has denied authorization to transmit a for a resource defined by attr-set-2 attributes\n\n{\n\"entityChainId\": \"ec1\",\n\"resourceAttributesId\": \"attr-set-1\",\n\"decision\": \"DECISION_PERMIT\",\n\"obligations\": [\n\"http://www.example.org/obligation/watermark\"\n]\n},\n{\n\"entityChainId\": \"ec1\",\n\"resourceAttributesId\": \"attr-set-2\",\n\"decision\": \"DECISION_PERMIT\"\n},\n{\n\"entityChainId\": \"ec2\",\n\"resourceAttributesId\": \"attr-set-1\",\n\"decision\": \"DECISION_PERMIT\"\n},\n{\n\"entityChainId\": \"ec2\",\n\"resourceAttributesId\": \"attr-set-2\",\n\"decision\": \"DECISION_DENY\"\n}",
"title": "Example response for a Decision Request - Do Bob (represented by entity chain ec1)\nand Alice (represented by entity chain ec2) have TRANSMIT authorization for\n2 resources; resource1 (attr-set-1) defined by attributes foo:bar resource2 (attr-set-2) defined by attribute foo:bar, color:red ?"
},
"authorizationEntity": {
"type": "object",
"properties": {
"id": {
"type": "string",
"title": "ephemeral id for tracking between request and response"
},
"emailAddress": {
"type": "string"
},
"userName": {
"type": "string"
},
"remoteClaimsUrl": {
"type": "string"
},
"jwt": {
"type": "string"
},
"claims": {
"$ref": "#/definitions/protobufAny"
},
"custom": {
"$ref": "#/definitions/authorizationEntityCustom"
}
},
"title": "PE (Person Entity) or NPE (Non-Person Entity)"
},
"authorizationEntityChain": {
"type": "object",
"properties": {
"id": {
"type": "string",
"title": "ephemeral id for tracking between request and response"
},
"entities": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/authorizationEntity"
}
}
},
"title": "A set of related PE and NPE"
},
"authorizationEntityCustom": {
"type": "object",
"properties": {
"extension": {
"$ref": "#/definitions/protobufAny"
}
},
"title": "Entity type for custom entities beyond the standard types"
},
"authorizationEntityEntitlements": {
"type": "object",
"properties": {
"entityId": {
"type": "string"
},
"attributeId": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"authorizationGetDecisionsResponse": {
"type": "object",
"properties": {
"decisionResponses": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/authorizationDecisionResponse"
}
}
}
},
"authorizationGetEntitlementsResponse": {
"type": "object",
"properties": {
"entitlements": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/authorizationEntityEntitlements"
}
}
},
"description": "{\n\"entitlements\": [\n{\n\"entityId\": \"e1\",\n\"attributeValueReferences\": [\n{\n\"attributeFqn\": \"http://www.example.org/attr/foo/value/bar\"\n}\n]\n},\n{\n\"entityId\": \"e2\",\n\"attributeValueReferences\": [\n{\n\"attributeFqn\": \"http://www.example.org/attr/color/value/red\"\n}\n]\n}\n]\n}",
"title": "Example Response for a request of : Get entitlements for bob and alice (both represented using an email address"
},
"authorizationResourceAttributes": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"attributeId": {
"type": "array",
"items": {
"type": "string"
}
}
},
"title": "A logical bucket of attributes belonging to a \"Resource\""
},
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"type": "string",
"description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics."
}
},
"additionalProperties": {},
"description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }"
},
"rpcStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
}
}
}
}
46 changes: 46 additions & 0 deletions docs/openapi/common/common.swagger.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"swagger": "2.0",
"info": {
"title": "common/common.proto",
"version": "version not set"
},
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {},
"definitions": {
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"type": "string",
"description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics."
}
},
"additionalProperties": {},
"description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }"
},
"rpcStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
}
}
}
}
Loading