otdf-python 0.1.9__py3-none-any.whl → 0.3.1__py3-none-any.whl
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.
- otdf_python/__init__.py +25 -0
- otdf_python/__main__.py +12 -0
- otdf_python/address_normalizer.py +84 -0
- otdf_python/aesgcm.py +55 -0
- otdf_python/assertion_config.py +84 -0
- otdf_python/asym_crypto.py +85 -0
- otdf_python/asym_decryption.py +53 -0
- otdf_python/asym_encryption.py +75 -0
- otdf_python/auth_headers.py +21 -0
- otdf_python/autoconfigure_utils.py +113 -0
- otdf_python/cli.py +570 -0
- otdf_python/collection_store.py +41 -0
- otdf_python/collection_store_impl.py +22 -0
- otdf_python/config.py +69 -0
- otdf_python/connect_client.py +0 -0
- otdf_python/constants.py +1 -0
- otdf_python/crypto_utils.py +78 -0
- otdf_python/dpop.py +81 -0
- otdf_python/ecc_mode.py +32 -0
- otdf_python/eckeypair.py +75 -0
- otdf_python/header.py +143 -0
- otdf_python/invalid_zip_exception.py +8 -0
- otdf_python/kas_client.py +603 -0
- otdf_python/kas_connect_rpc_client.py +207 -0
- otdf_python/kas_info.py +25 -0
- otdf_python/kas_key_cache.py +52 -0
- otdf_python/key_type.py +31 -0
- otdf_python/key_type_constants.py +43 -0
- otdf_python/manifest.py +215 -0
- otdf_python/nanotdf.py +553 -0
- otdf_python/nanotdf_ecdsa_struct.py +132 -0
- otdf_python/nanotdf_type.py +43 -0
- otdf_python/policy_binding_serializer.py +39 -0
- otdf_python/policy_info.py +78 -0
- otdf_python/policy_object.py +22 -0
- otdf_python/policy_stub.py +2 -0
- otdf_python/resource_locator.py +44 -0
- otdf_python/sdk.py +528 -0
- otdf_python/sdk_builder.py +448 -0
- otdf_python/sdk_exceptions.py +16 -0
- otdf_python/symmetric_and_payload_config.py +30 -0
- otdf_python/tdf.py +479 -0
- otdf_python/tdf_reader.py +153 -0
- otdf_python/tdf_writer.py +23 -0
- otdf_python/token_source.py +34 -0
- otdf_python/version.py +57 -0
- otdf_python/zip_reader.py +47 -0
- otdf_python/zip_writer.py +70 -0
- otdf_python-0.3.1.dist-info/METADATA +231 -0
- otdf_python-0.3.1.dist-info/RECORD +137 -0
- {otdf_python-0.1.9.dist-info → otdf_python-0.3.1.dist-info}/WHEEL +1 -2
- {otdf_python-0.1.9.dist-info → otdf_python-0.3.1.dist-info/licenses}/LICENSE +1 -1
- otdf_python_proto/__init__.py +37 -0
- otdf_python_proto/authorization/__init__.py +1 -0
- otdf_python_proto/authorization/authorization_pb2.py +80 -0
- otdf_python_proto/authorization/authorization_pb2.pyi +161 -0
- otdf_python_proto/authorization/authorization_pb2_connect.py +191 -0
- otdf_python_proto/authorization/v2/authorization_pb2.py +105 -0
- otdf_python_proto/authorization/v2/authorization_pb2.pyi +134 -0
- otdf_python_proto/authorization/v2/authorization_pb2_connect.py +233 -0
- otdf_python_proto/common/__init__.py +1 -0
- otdf_python_proto/common/common_pb2.py +52 -0
- otdf_python_proto/common/common_pb2.pyi +61 -0
- otdf_python_proto/entity/__init__.py +1 -0
- otdf_python_proto/entity/entity_pb2.py +47 -0
- otdf_python_proto/entity/entity_pb2.pyi +50 -0
- otdf_python_proto/entityresolution/__init__.py +1 -0
- otdf_python_proto/entityresolution/entity_resolution_pb2.py +57 -0
- otdf_python_proto/entityresolution/entity_resolution_pb2.pyi +55 -0
- otdf_python_proto/entityresolution/entity_resolution_pb2_connect.py +149 -0
- otdf_python_proto/entityresolution/v2/entity_resolution_pb2.py +55 -0
- otdf_python_proto/entityresolution/v2/entity_resolution_pb2.pyi +55 -0
- otdf_python_proto/entityresolution/v2/entity_resolution_pb2_connect.py +149 -0
- otdf_python_proto/kas/__init__.py +9 -0
- otdf_python_proto/kas/kas_pb2.py +103 -0
- otdf_python_proto/kas/kas_pb2.pyi +170 -0
- otdf_python_proto/kas/kas_pb2_connect.py +192 -0
- otdf_python_proto/legacy_grpc/__init__.py +1 -0
- otdf_python_proto/legacy_grpc/authorization/authorization_pb2_grpc.py +163 -0
- otdf_python_proto/legacy_grpc/authorization/v2/authorization_pb2_grpc.py +206 -0
- otdf_python_proto/legacy_grpc/common/common_pb2_grpc.py +4 -0
- otdf_python_proto/legacy_grpc/entity/entity_pb2_grpc.py +4 -0
- otdf_python_proto/legacy_grpc/entityresolution/entity_resolution_pb2_grpc.py +122 -0
- otdf_python_proto/legacy_grpc/entityresolution/v2/entity_resolution_pb2_grpc.py +120 -0
- otdf_python_proto/legacy_grpc/kas/kas_pb2_grpc.py +172 -0
- otdf_python_proto/legacy_grpc/logger/audit/test_pb2_grpc.py +4 -0
- otdf_python_proto/legacy_grpc/policy/actions/actions_pb2_grpc.py +249 -0
- otdf_python_proto/legacy_grpc/policy/attributes/attributes_pb2_grpc.py +873 -0
- otdf_python_proto/legacy_grpc/policy/kasregistry/key_access_server_registry_pb2_grpc.py +602 -0
- otdf_python_proto/legacy_grpc/policy/keymanagement/key_management_pb2_grpc.py +251 -0
- otdf_python_proto/legacy_grpc/policy/namespaces/namespaces_pb2_grpc.py +427 -0
- otdf_python_proto/legacy_grpc/policy/objects_pb2_grpc.py +4 -0
- otdf_python_proto/legacy_grpc/policy/registeredresources/registered_resources_pb2_grpc.py +524 -0
- otdf_python_proto/legacy_grpc/policy/resourcemapping/resource_mapping_pb2_grpc.py +516 -0
- otdf_python_proto/legacy_grpc/policy/selectors_pb2_grpc.py +4 -0
- otdf_python_proto/legacy_grpc/policy/subjectmapping/subject_mapping_pb2_grpc.py +551 -0
- otdf_python_proto/legacy_grpc/policy/unsafe/unsafe_pb2_grpc.py +485 -0
- otdf_python_proto/legacy_grpc/wellknownconfiguration/wellknown_configuration_pb2_grpc.py +77 -0
- otdf_python_proto/logger/__init__.py +1 -0
- otdf_python_proto/logger/audit/test_pb2.py +43 -0
- otdf_python_proto/logger/audit/test_pb2.pyi +45 -0
- otdf_python_proto/policy/__init__.py +1 -0
- otdf_python_proto/policy/actions/actions_pb2.py +75 -0
- otdf_python_proto/policy/actions/actions_pb2.pyi +87 -0
- otdf_python_proto/policy/actions/actions_pb2_connect.py +275 -0
- otdf_python_proto/policy/attributes/attributes_pb2.py +234 -0
- otdf_python_proto/policy/attributes/attributes_pb2.pyi +328 -0
- otdf_python_proto/policy/attributes/attributes_pb2_connect.py +863 -0
- otdf_python_proto/policy/kasregistry/key_access_server_registry_pb2.py +266 -0
- otdf_python_proto/policy/kasregistry/key_access_server_registry_pb2.pyi +450 -0
- otdf_python_proto/policy/kasregistry/key_access_server_registry_pb2_connect.py +611 -0
- otdf_python_proto/policy/keymanagement/key_management_pb2.py +79 -0
- otdf_python_proto/policy/keymanagement/key_management_pb2.pyi +87 -0
- otdf_python_proto/policy/keymanagement/key_management_pb2_connect.py +275 -0
- otdf_python_proto/policy/namespaces/namespaces_pb2.py +117 -0
- otdf_python_proto/policy/namespaces/namespaces_pb2.pyi +147 -0
- otdf_python_proto/policy/namespaces/namespaces_pb2_connect.py +443 -0
- otdf_python_proto/policy/objects_pb2.py +150 -0
- otdf_python_proto/policy/objects_pb2.pyi +464 -0
- otdf_python_proto/policy/registeredresources/registered_resources_pb2.py +139 -0
- otdf_python_proto/policy/registeredresources/registered_resources_pb2.pyi +196 -0
- otdf_python_proto/policy/registeredresources/registered_resources_pb2_connect.py +527 -0
- otdf_python_proto/policy/resourcemapping/resource_mapping_pb2.py +139 -0
- otdf_python_proto/policy/resourcemapping/resource_mapping_pb2.pyi +194 -0
- otdf_python_proto/policy/resourcemapping/resource_mapping_pb2_connect.py +527 -0
- otdf_python_proto/policy/selectors_pb2.py +57 -0
- otdf_python_proto/policy/selectors_pb2.pyi +90 -0
- otdf_python_proto/policy/subjectmapping/subject_mapping_pb2.py +127 -0
- otdf_python_proto/policy/subjectmapping/subject_mapping_pb2.pyi +189 -0
- otdf_python_proto/policy/subjectmapping/subject_mapping_pb2_connect.py +569 -0
- otdf_python_proto/policy/unsafe/unsafe_pb2.py +113 -0
- otdf_python_proto/policy/unsafe/unsafe_pb2.pyi +145 -0
- otdf_python_proto/policy/unsafe/unsafe_pb2_connect.py +485 -0
- otdf_python_proto/wellknownconfiguration/__init__.py +1 -0
- otdf_python_proto/wellknownconfiguration/wellknown_configuration_pb2.py +51 -0
- otdf_python_proto/wellknownconfiguration/wellknown_configuration_pb2.pyi +32 -0
- otdf_python_proto/wellknownconfiguration/wellknown_configuration_pb2_connect.py +107 -0
- otdf_python/_gotdf_python.cpython-312-darwin.so +0 -0
- otdf_python/build.py +0 -190
- otdf_python/go.py +0 -1478
- otdf_python/gotdf_python.py +0 -383
- otdf_python-0.1.9.dist-info/METADATA +0 -149
- otdf_python-0.1.9.dist-info/RECORD +0 -10
- otdf_python-0.1.9.dist-info/top_level.txt +0 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
|
+
# source: authorization/authorization.proto
|
|
5
|
+
# Protobuf Python Version: 6.31.1
|
|
6
|
+
"""Generated protocol buffer code."""
|
|
7
|
+
from google.protobuf import descriptor as _descriptor
|
|
8
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
|
10
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
11
|
+
from google.protobuf.internal import builder as _builder
|
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
|
14
|
+
6,
|
|
15
|
+
31,
|
|
16
|
+
1,
|
|
17
|
+
'',
|
|
18
|
+
'authorization/authorization.proto'
|
|
19
|
+
)
|
|
20
|
+
# @@protoc_insertion_point(imports)
|
|
21
|
+
|
|
22
|
+
_sym_db = _symbol_database.Default()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
|
|
26
|
+
from google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2
|
|
27
|
+
from policy import objects_pb2 as policy_dot_objects__pb2
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!authorization/authorization.proto\x12\rauthorization\x1a\x1cgoogle/api/annotations.proto\x1a\x19google/protobuf/any.proto\x1a\x14policy/objects.proto\")\n\x05Token\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x10\n\x03jwt\x18\x02 \x01(\tR\x03jwt\"\xc9\x03\n\x06\x45ntity\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12%\n\remail_address\x18\x02 \x01(\tH\x00R\x0c\x65mailAddress\x12\x1d\n\tuser_name\x18\x03 \x01(\tH\x00R\x08userName\x12,\n\x11remote_claims_url\x18\x04 \x01(\tH\x00R\x0fremoteClaimsUrl\x12\x14\n\x04uuid\x18\x05 \x01(\tH\x00R\x04uuid\x12.\n\x06\x63laims\x18\x06 \x01(\x0b\x32\x14.google.protobuf.AnyH\x00R\x06\x63laims\x12\x35\n\x06\x63ustom\x18\x07 \x01(\x0b\x32\x1b.authorization.EntityCustomH\x00R\x06\x63ustom\x12\x1d\n\tclient_id\x18\x08 \x01(\tH\x00R\x08\x63lientId\x12:\n\x08\x63\x61tegory\x18\t \x01(\x0e\x32\x1e.authorization.Entity.CategoryR\x08\x63\x61tegory\"T\n\x08\x43\x61tegory\x12\x18\n\x14\x43\x41TEGORY_UNSPECIFIED\x10\x00\x12\x14\n\x10\x43\x41TEGORY_SUBJECT\x10\x01\x12\x18\n\x14\x43\x41TEGORY_ENVIRONMENT\x10\x02\x42\r\n\x0b\x65ntity_type\"B\n\x0c\x45ntityCustom\x12\x32\n\textension\x18\x01 \x01(\x0b\x32\x14.google.protobuf.AnyR\textension\"P\n\x0b\x45ntityChain\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x31\n\x08\x65ntities\x18\x02 \x03(\x0b\x32\x15.authorization.EntityR\x08\x65ntities\"\xcf\x01\n\x0f\x44\x65\x63isionRequest\x12(\n\x07\x61\x63tions\x18\x01 \x03(\x0b\x32\x0e.policy.ActionR\x07\x61\x63tions\x12?\n\rentity_chains\x18\x02 \x03(\x0b\x32\x1a.authorization.EntityChainR\x0c\x65ntityChains\x12Q\n\x13resource_attributes\x18\x03 \x03(\x0b\x32 .authorization.ResourceAttributeR\x12resourceAttributes\"\xce\x02\n\x10\x44\x65\x63isionResponse\x12&\n\x0f\x65ntity_chain_id\x18\x01 \x01(\tR\rentityChainId\x12\x34\n\x16resource_attributes_id\x18\x02 \x01(\tR\x14resourceAttributesId\x12&\n\x06\x61\x63tion\x18\x03 \x01(\x0b\x32\x0e.policy.ActionR\x06\x61\x63tion\x12\x44\n\x08\x64\x65\x63ision\x18\x04 \x01(\x0e\x32(.authorization.DecisionResponse.DecisionR\x08\x64\x65\x63ision\x12 \n\x0bobligations\x18\x05 \x03(\tR\x0bobligations\"L\n\x08\x44\x65\x63ision\x12\x18\n\x14\x44\x45\x43ISION_UNSPECIFIED\x10\x00\x12\x11\n\rDECISION_DENY\x10\x01\x12\x13\n\x0f\x44\x45\x43ISION_PERMIT\x10\x02\"b\n\x13GetDecisionsRequest\x12K\n\x11\x64\x65\x63ision_requests\x18\x01 \x03(\x0b\x32\x1e.authorization.DecisionRequestR\x10\x64\x65\x63isionRequests\"f\n\x14GetDecisionsResponse\x12N\n\x12\x64\x65\x63ision_responses\x18\x01 \x03(\x0b\x32\x1f.authorization.DecisionResponseR\x11\x64\x65\x63isionResponses\"\xfa\x01\n\x16GetEntitlementsRequest\x12\x31\n\x08\x65ntities\x18\x01 \x03(\x0b\x32\x15.authorization.EntityR\x08\x65ntities\x12;\n\x05scope\x18\x02 \x01(\x0b\x32 .authorization.ResourceAttributeH\x00R\x05scope\x88\x01\x01\x12\x45\n\x1cwith_comprehensive_hierarchy\x18\x03 \x01(\x08H\x01R\x1awithComprehensiveHierarchy\x88\x01\x01\x42\x08\n\x06_scopeB\x1f\n\x1d_with_comprehensive_hierarchy\"c\n\x12\x45ntityEntitlements\x12\x1b\n\tentity_id\x18\x01 \x01(\tR\x08\x65ntityId\x12\x30\n\x14\x61ttribute_value_fqns\x18\x02 \x03(\tR\x12\x61ttributeValueFqns\"{\n\x11ResourceAttribute\x12\x34\n\x16resource_attributes_id\x18\x01 \x01(\tR\x14resourceAttributesId\x12\x30\n\x14\x61ttribute_value_fqns\x18\x02 \x03(\tR\x12\x61ttributeValueFqns\"`\n\x17GetEntitlementsResponse\x12\x45\n\x0c\x65ntitlements\x18\x01 \x03(\x0b\x32!.authorization.EntityEntitlementsR\x0c\x65ntitlements\"\xc1\x01\n\x14TokenDecisionRequest\x12(\n\x07\x61\x63tions\x18\x01 \x03(\x0b\x32\x0e.policy.ActionR\x07\x61\x63tions\x12,\n\x06tokens\x18\x02 \x03(\x0b\x32\x14.authorization.TokenR\x06tokens\x12Q\n\x13resource_attributes\x18\x03 \x03(\x0b\x32 .authorization.ResourceAttributeR\x12resourceAttributes\"n\n\x1aGetDecisionsByTokenRequest\x12P\n\x11\x64\x65\x63ision_requests\x18\x01 \x03(\x0b\x32#.authorization.TokenDecisionRequestR\x10\x64\x65\x63isionRequests\"m\n\x1bGetDecisionsByTokenResponse\x12N\n\x12\x64\x65\x63ision_responses\x18\x01 \x03(\x0b\x32\x1f.authorization.DecisionResponseR\x11\x64\x65\x63isionResponses2\x9c\x03\n\x14\x41uthorizationService\x12u\n\x0cGetDecisions\x12\".authorization.GetDecisionsRequest\x1a#.authorization.GetDecisionsResponse\"\x1c\x82\xd3\xe4\x93\x02\x16\"\x11/v1/authorization:\x01*\x12\x8d\x01\n\x13GetDecisionsByToken\x12).authorization.GetDecisionsByTokenRequest\x1a*.authorization.GetDecisionsByTokenResponse\"\x1f\x82\xd3\xe4\x93\x02\x19\"\x17/v1/token/authorization\x12}\n\x0fGetEntitlements\x12%.authorization.GetEntitlementsRequest\x1a&.authorization.GetEntitlementsResponse\"\x1b\x82\xd3\xe4\x93\x02\x15\"\x10/v1/entitlements:\x01*B{\n\x11\x63om.authorizationB\x12\x41uthorizationProtoP\x01\xa2\x02\x03\x41XX\xaa\x02\rAuthorization\xca\x02\rAuthorization\xe2\x02\x19\x41uthorization\\GPBMetadata\xea\x02\rAuthorizationb\x06proto3')
|
|
31
|
+
|
|
32
|
+
_globals = globals()
|
|
33
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
34
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'authorization.authorization_pb2', _globals)
|
|
35
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
36
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
|
37
|
+
_globals['DESCRIPTOR']._serialized_options = b'\n\021com.authorizationB\022AuthorizationProtoP\001\242\002\003AXX\252\002\rAuthorization\312\002\rAuthorization\342\002\031Authorization\\GPBMetadata\352\002\rAuthorization'
|
|
38
|
+
_globals['_AUTHORIZATIONSERVICE'].methods_by_name['GetDecisions']._loaded_options = None
|
|
39
|
+
_globals['_AUTHORIZATIONSERVICE'].methods_by_name['GetDecisions']._serialized_options = b'\202\323\344\223\002\026\"\021/v1/authorization:\001*'
|
|
40
|
+
_globals['_AUTHORIZATIONSERVICE'].methods_by_name['GetDecisionsByToken']._loaded_options = None
|
|
41
|
+
_globals['_AUTHORIZATIONSERVICE'].methods_by_name['GetDecisionsByToken']._serialized_options = b'\202\323\344\223\002\031\"\027/v1/token/authorization'
|
|
42
|
+
_globals['_AUTHORIZATIONSERVICE'].methods_by_name['GetEntitlements']._loaded_options = None
|
|
43
|
+
_globals['_AUTHORIZATIONSERVICE'].methods_by_name['GetEntitlements']._serialized_options = b'\202\323\344\223\002\025\"\020/v1/entitlements:\001*'
|
|
44
|
+
_globals['_TOKEN']._serialized_start=131
|
|
45
|
+
_globals['_TOKEN']._serialized_end=172
|
|
46
|
+
_globals['_ENTITY']._serialized_start=175
|
|
47
|
+
_globals['_ENTITY']._serialized_end=632
|
|
48
|
+
_globals['_ENTITY_CATEGORY']._serialized_start=533
|
|
49
|
+
_globals['_ENTITY_CATEGORY']._serialized_end=617
|
|
50
|
+
_globals['_ENTITYCUSTOM']._serialized_start=634
|
|
51
|
+
_globals['_ENTITYCUSTOM']._serialized_end=700
|
|
52
|
+
_globals['_ENTITYCHAIN']._serialized_start=702
|
|
53
|
+
_globals['_ENTITYCHAIN']._serialized_end=782
|
|
54
|
+
_globals['_DECISIONREQUEST']._serialized_start=785
|
|
55
|
+
_globals['_DECISIONREQUEST']._serialized_end=992
|
|
56
|
+
_globals['_DECISIONRESPONSE']._serialized_start=995
|
|
57
|
+
_globals['_DECISIONRESPONSE']._serialized_end=1329
|
|
58
|
+
_globals['_DECISIONRESPONSE_DECISION']._serialized_start=1253
|
|
59
|
+
_globals['_DECISIONRESPONSE_DECISION']._serialized_end=1329
|
|
60
|
+
_globals['_GETDECISIONSREQUEST']._serialized_start=1331
|
|
61
|
+
_globals['_GETDECISIONSREQUEST']._serialized_end=1429
|
|
62
|
+
_globals['_GETDECISIONSRESPONSE']._serialized_start=1431
|
|
63
|
+
_globals['_GETDECISIONSRESPONSE']._serialized_end=1533
|
|
64
|
+
_globals['_GETENTITLEMENTSREQUEST']._serialized_start=1536
|
|
65
|
+
_globals['_GETENTITLEMENTSREQUEST']._serialized_end=1786
|
|
66
|
+
_globals['_ENTITYENTITLEMENTS']._serialized_start=1788
|
|
67
|
+
_globals['_ENTITYENTITLEMENTS']._serialized_end=1887
|
|
68
|
+
_globals['_RESOURCEATTRIBUTE']._serialized_start=1889
|
|
69
|
+
_globals['_RESOURCEATTRIBUTE']._serialized_end=2012
|
|
70
|
+
_globals['_GETENTITLEMENTSRESPONSE']._serialized_start=2014
|
|
71
|
+
_globals['_GETENTITLEMENTSRESPONSE']._serialized_end=2110
|
|
72
|
+
_globals['_TOKENDECISIONREQUEST']._serialized_start=2113
|
|
73
|
+
_globals['_TOKENDECISIONREQUEST']._serialized_end=2306
|
|
74
|
+
_globals['_GETDECISIONSBYTOKENREQUEST']._serialized_start=2308
|
|
75
|
+
_globals['_GETDECISIONSBYTOKENREQUEST']._serialized_end=2418
|
|
76
|
+
_globals['_GETDECISIONSBYTOKENRESPONSE']._serialized_start=2420
|
|
77
|
+
_globals['_GETDECISIONSBYTOKENRESPONSE']._serialized_end=2529
|
|
78
|
+
_globals['_AUTHORIZATIONSERVICE']._serialized_start=2532
|
|
79
|
+
_globals['_AUTHORIZATIONSERVICE']._serialized_end=2944
|
|
80
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
from google.api import annotations_pb2 as _annotations_pb2
|
|
2
|
+
from google.protobuf import any_pb2 as _any_pb2
|
|
3
|
+
from policy import objects_pb2 as _objects_pb2
|
|
4
|
+
from google.protobuf.internal import containers as _containers
|
|
5
|
+
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
|
|
6
|
+
from google.protobuf import descriptor as _descriptor
|
|
7
|
+
from google.protobuf import message as _message
|
|
8
|
+
from collections.abc import Iterable as _Iterable, Mapping as _Mapping
|
|
9
|
+
from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union
|
|
10
|
+
|
|
11
|
+
DESCRIPTOR: _descriptor.FileDescriptor
|
|
12
|
+
|
|
13
|
+
class Token(_message.Message):
|
|
14
|
+
__slots__ = ("id", "jwt")
|
|
15
|
+
ID_FIELD_NUMBER: _ClassVar[int]
|
|
16
|
+
JWT_FIELD_NUMBER: _ClassVar[int]
|
|
17
|
+
id: str
|
|
18
|
+
jwt: str
|
|
19
|
+
def __init__(self, id: _Optional[str] = ..., jwt: _Optional[str] = ...) -> None: ...
|
|
20
|
+
|
|
21
|
+
class Entity(_message.Message):
|
|
22
|
+
__slots__ = ("id", "email_address", "user_name", "remote_claims_url", "uuid", "claims", "custom", "client_id", "category")
|
|
23
|
+
class Category(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
24
|
+
__slots__ = ()
|
|
25
|
+
CATEGORY_UNSPECIFIED: _ClassVar[Entity.Category]
|
|
26
|
+
CATEGORY_SUBJECT: _ClassVar[Entity.Category]
|
|
27
|
+
CATEGORY_ENVIRONMENT: _ClassVar[Entity.Category]
|
|
28
|
+
CATEGORY_UNSPECIFIED: Entity.Category
|
|
29
|
+
CATEGORY_SUBJECT: Entity.Category
|
|
30
|
+
CATEGORY_ENVIRONMENT: Entity.Category
|
|
31
|
+
ID_FIELD_NUMBER: _ClassVar[int]
|
|
32
|
+
EMAIL_ADDRESS_FIELD_NUMBER: _ClassVar[int]
|
|
33
|
+
USER_NAME_FIELD_NUMBER: _ClassVar[int]
|
|
34
|
+
REMOTE_CLAIMS_URL_FIELD_NUMBER: _ClassVar[int]
|
|
35
|
+
UUID_FIELD_NUMBER: _ClassVar[int]
|
|
36
|
+
CLAIMS_FIELD_NUMBER: _ClassVar[int]
|
|
37
|
+
CUSTOM_FIELD_NUMBER: _ClassVar[int]
|
|
38
|
+
CLIENT_ID_FIELD_NUMBER: _ClassVar[int]
|
|
39
|
+
CATEGORY_FIELD_NUMBER: _ClassVar[int]
|
|
40
|
+
id: str
|
|
41
|
+
email_address: str
|
|
42
|
+
user_name: str
|
|
43
|
+
remote_claims_url: str
|
|
44
|
+
uuid: str
|
|
45
|
+
claims: _any_pb2.Any
|
|
46
|
+
custom: EntityCustom
|
|
47
|
+
client_id: str
|
|
48
|
+
category: Entity.Category
|
|
49
|
+
def __init__(self, id: _Optional[str] = ..., email_address: _Optional[str] = ..., user_name: _Optional[str] = ..., remote_claims_url: _Optional[str] = ..., uuid: _Optional[str] = ..., claims: _Optional[_Union[_any_pb2.Any, _Mapping]] = ..., custom: _Optional[_Union[EntityCustom, _Mapping]] = ..., client_id: _Optional[str] = ..., category: _Optional[_Union[Entity.Category, str]] = ...) -> None: ...
|
|
50
|
+
|
|
51
|
+
class EntityCustom(_message.Message):
|
|
52
|
+
__slots__ = ("extension",)
|
|
53
|
+
EXTENSION_FIELD_NUMBER: _ClassVar[int]
|
|
54
|
+
extension: _any_pb2.Any
|
|
55
|
+
def __init__(self, extension: _Optional[_Union[_any_pb2.Any, _Mapping]] = ...) -> None: ...
|
|
56
|
+
|
|
57
|
+
class EntityChain(_message.Message):
|
|
58
|
+
__slots__ = ("id", "entities")
|
|
59
|
+
ID_FIELD_NUMBER: _ClassVar[int]
|
|
60
|
+
ENTITIES_FIELD_NUMBER: _ClassVar[int]
|
|
61
|
+
id: str
|
|
62
|
+
entities: _containers.RepeatedCompositeFieldContainer[Entity]
|
|
63
|
+
def __init__(self, id: _Optional[str] = ..., entities: _Optional[_Iterable[_Union[Entity, _Mapping]]] = ...) -> None: ...
|
|
64
|
+
|
|
65
|
+
class DecisionRequest(_message.Message):
|
|
66
|
+
__slots__ = ("actions", "entity_chains", "resource_attributes")
|
|
67
|
+
ACTIONS_FIELD_NUMBER: _ClassVar[int]
|
|
68
|
+
ENTITY_CHAINS_FIELD_NUMBER: _ClassVar[int]
|
|
69
|
+
RESOURCE_ATTRIBUTES_FIELD_NUMBER: _ClassVar[int]
|
|
70
|
+
actions: _containers.RepeatedCompositeFieldContainer[_objects_pb2.Action]
|
|
71
|
+
entity_chains: _containers.RepeatedCompositeFieldContainer[EntityChain]
|
|
72
|
+
resource_attributes: _containers.RepeatedCompositeFieldContainer[ResourceAttribute]
|
|
73
|
+
def __init__(self, actions: _Optional[_Iterable[_Union[_objects_pb2.Action, _Mapping]]] = ..., entity_chains: _Optional[_Iterable[_Union[EntityChain, _Mapping]]] = ..., resource_attributes: _Optional[_Iterable[_Union[ResourceAttribute, _Mapping]]] = ...) -> None: ...
|
|
74
|
+
|
|
75
|
+
class DecisionResponse(_message.Message):
|
|
76
|
+
__slots__ = ("entity_chain_id", "resource_attributes_id", "action", "decision", "obligations")
|
|
77
|
+
class Decision(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
78
|
+
__slots__ = ()
|
|
79
|
+
DECISION_UNSPECIFIED: _ClassVar[DecisionResponse.Decision]
|
|
80
|
+
DECISION_DENY: _ClassVar[DecisionResponse.Decision]
|
|
81
|
+
DECISION_PERMIT: _ClassVar[DecisionResponse.Decision]
|
|
82
|
+
DECISION_UNSPECIFIED: DecisionResponse.Decision
|
|
83
|
+
DECISION_DENY: DecisionResponse.Decision
|
|
84
|
+
DECISION_PERMIT: DecisionResponse.Decision
|
|
85
|
+
ENTITY_CHAIN_ID_FIELD_NUMBER: _ClassVar[int]
|
|
86
|
+
RESOURCE_ATTRIBUTES_ID_FIELD_NUMBER: _ClassVar[int]
|
|
87
|
+
ACTION_FIELD_NUMBER: _ClassVar[int]
|
|
88
|
+
DECISION_FIELD_NUMBER: _ClassVar[int]
|
|
89
|
+
OBLIGATIONS_FIELD_NUMBER: _ClassVar[int]
|
|
90
|
+
entity_chain_id: str
|
|
91
|
+
resource_attributes_id: str
|
|
92
|
+
action: _objects_pb2.Action
|
|
93
|
+
decision: DecisionResponse.Decision
|
|
94
|
+
obligations: _containers.RepeatedScalarFieldContainer[str]
|
|
95
|
+
def __init__(self, entity_chain_id: _Optional[str] = ..., resource_attributes_id: _Optional[str] = ..., action: _Optional[_Union[_objects_pb2.Action, _Mapping]] = ..., decision: _Optional[_Union[DecisionResponse.Decision, str]] = ..., obligations: _Optional[_Iterable[str]] = ...) -> None: ...
|
|
96
|
+
|
|
97
|
+
class GetDecisionsRequest(_message.Message):
|
|
98
|
+
__slots__ = ("decision_requests",)
|
|
99
|
+
DECISION_REQUESTS_FIELD_NUMBER: _ClassVar[int]
|
|
100
|
+
decision_requests: _containers.RepeatedCompositeFieldContainer[DecisionRequest]
|
|
101
|
+
def __init__(self, decision_requests: _Optional[_Iterable[_Union[DecisionRequest, _Mapping]]] = ...) -> None: ...
|
|
102
|
+
|
|
103
|
+
class GetDecisionsResponse(_message.Message):
|
|
104
|
+
__slots__ = ("decision_responses",)
|
|
105
|
+
DECISION_RESPONSES_FIELD_NUMBER: _ClassVar[int]
|
|
106
|
+
decision_responses: _containers.RepeatedCompositeFieldContainer[DecisionResponse]
|
|
107
|
+
def __init__(self, decision_responses: _Optional[_Iterable[_Union[DecisionResponse, _Mapping]]] = ...) -> None: ...
|
|
108
|
+
|
|
109
|
+
class GetEntitlementsRequest(_message.Message):
|
|
110
|
+
__slots__ = ("entities", "scope", "with_comprehensive_hierarchy")
|
|
111
|
+
ENTITIES_FIELD_NUMBER: _ClassVar[int]
|
|
112
|
+
SCOPE_FIELD_NUMBER: _ClassVar[int]
|
|
113
|
+
WITH_COMPREHENSIVE_HIERARCHY_FIELD_NUMBER: _ClassVar[int]
|
|
114
|
+
entities: _containers.RepeatedCompositeFieldContainer[Entity]
|
|
115
|
+
scope: ResourceAttribute
|
|
116
|
+
with_comprehensive_hierarchy: bool
|
|
117
|
+
def __init__(self, entities: _Optional[_Iterable[_Union[Entity, _Mapping]]] = ..., scope: _Optional[_Union[ResourceAttribute, _Mapping]] = ..., with_comprehensive_hierarchy: bool = ...) -> None: ...
|
|
118
|
+
|
|
119
|
+
class EntityEntitlements(_message.Message):
|
|
120
|
+
__slots__ = ("entity_id", "attribute_value_fqns")
|
|
121
|
+
ENTITY_ID_FIELD_NUMBER: _ClassVar[int]
|
|
122
|
+
ATTRIBUTE_VALUE_FQNS_FIELD_NUMBER: _ClassVar[int]
|
|
123
|
+
entity_id: str
|
|
124
|
+
attribute_value_fqns: _containers.RepeatedScalarFieldContainer[str]
|
|
125
|
+
def __init__(self, entity_id: _Optional[str] = ..., attribute_value_fqns: _Optional[_Iterable[str]] = ...) -> None: ...
|
|
126
|
+
|
|
127
|
+
class ResourceAttribute(_message.Message):
|
|
128
|
+
__slots__ = ("resource_attributes_id", "attribute_value_fqns")
|
|
129
|
+
RESOURCE_ATTRIBUTES_ID_FIELD_NUMBER: _ClassVar[int]
|
|
130
|
+
ATTRIBUTE_VALUE_FQNS_FIELD_NUMBER: _ClassVar[int]
|
|
131
|
+
resource_attributes_id: str
|
|
132
|
+
attribute_value_fqns: _containers.RepeatedScalarFieldContainer[str]
|
|
133
|
+
def __init__(self, resource_attributes_id: _Optional[str] = ..., attribute_value_fqns: _Optional[_Iterable[str]] = ...) -> None: ...
|
|
134
|
+
|
|
135
|
+
class GetEntitlementsResponse(_message.Message):
|
|
136
|
+
__slots__ = ("entitlements",)
|
|
137
|
+
ENTITLEMENTS_FIELD_NUMBER: _ClassVar[int]
|
|
138
|
+
entitlements: _containers.RepeatedCompositeFieldContainer[EntityEntitlements]
|
|
139
|
+
def __init__(self, entitlements: _Optional[_Iterable[_Union[EntityEntitlements, _Mapping]]] = ...) -> None: ...
|
|
140
|
+
|
|
141
|
+
class TokenDecisionRequest(_message.Message):
|
|
142
|
+
__slots__ = ("actions", "tokens", "resource_attributes")
|
|
143
|
+
ACTIONS_FIELD_NUMBER: _ClassVar[int]
|
|
144
|
+
TOKENS_FIELD_NUMBER: _ClassVar[int]
|
|
145
|
+
RESOURCE_ATTRIBUTES_FIELD_NUMBER: _ClassVar[int]
|
|
146
|
+
actions: _containers.RepeatedCompositeFieldContainer[_objects_pb2.Action]
|
|
147
|
+
tokens: _containers.RepeatedCompositeFieldContainer[Token]
|
|
148
|
+
resource_attributes: _containers.RepeatedCompositeFieldContainer[ResourceAttribute]
|
|
149
|
+
def __init__(self, actions: _Optional[_Iterable[_Union[_objects_pb2.Action, _Mapping]]] = ..., tokens: _Optional[_Iterable[_Union[Token, _Mapping]]] = ..., resource_attributes: _Optional[_Iterable[_Union[ResourceAttribute, _Mapping]]] = ...) -> None: ...
|
|
150
|
+
|
|
151
|
+
class GetDecisionsByTokenRequest(_message.Message):
|
|
152
|
+
__slots__ = ("decision_requests",)
|
|
153
|
+
DECISION_REQUESTS_FIELD_NUMBER: _ClassVar[int]
|
|
154
|
+
decision_requests: _containers.RepeatedCompositeFieldContainer[TokenDecisionRequest]
|
|
155
|
+
def __init__(self, decision_requests: _Optional[_Iterable[_Union[TokenDecisionRequest, _Mapping]]] = ...) -> None: ...
|
|
156
|
+
|
|
157
|
+
class GetDecisionsByTokenResponse(_message.Message):
|
|
158
|
+
__slots__ = ("decision_responses",)
|
|
159
|
+
DECISION_RESPONSES_FIELD_NUMBER: _ClassVar[int]
|
|
160
|
+
decision_responses: _containers.RepeatedCompositeFieldContainer[DecisionResponse]
|
|
161
|
+
def __init__(self, decision_responses: _Optional[_Iterable[_Union[DecisionResponse, _Mapping]]] = ...) -> None: ...
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# Generated Connect client code
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from collections.abc import AsyncIterator
|
|
5
|
+
from collections.abc import Iterator
|
|
6
|
+
from collections.abc import Iterable
|
|
7
|
+
import aiohttp
|
|
8
|
+
import urllib3
|
|
9
|
+
import typing
|
|
10
|
+
import sys
|
|
11
|
+
|
|
12
|
+
from connectrpc.client_async import AsyncConnectClient
|
|
13
|
+
from connectrpc.client_sync import ConnectClient
|
|
14
|
+
from connectrpc.client_protocol import ConnectProtocol
|
|
15
|
+
from connectrpc.client_connect import ConnectProtocolError
|
|
16
|
+
from connectrpc.headers import HeaderInput
|
|
17
|
+
from connectrpc.server import ClientRequest
|
|
18
|
+
from connectrpc.server import ClientStream
|
|
19
|
+
from connectrpc.server import ServerResponse
|
|
20
|
+
from connectrpc.server import ServerStream
|
|
21
|
+
from connectrpc.server_sync import ConnectWSGI
|
|
22
|
+
from connectrpc.streams import StreamInput
|
|
23
|
+
from connectrpc.streams import AsyncStreamOutput
|
|
24
|
+
from connectrpc.streams import StreamOutput
|
|
25
|
+
from connectrpc.unary import UnaryOutput
|
|
26
|
+
from connectrpc.unary import ClientStreamingOutput
|
|
27
|
+
|
|
28
|
+
if typing.TYPE_CHECKING:
|
|
29
|
+
# wsgiref.types was added in Python 3.11.
|
|
30
|
+
if sys.version_info >= (3, 11):
|
|
31
|
+
from wsgiref.types import WSGIApplication
|
|
32
|
+
else:
|
|
33
|
+
from _typeshed.wsgi import WSGIApplication
|
|
34
|
+
|
|
35
|
+
import authorization.authorization_pb2
|
|
36
|
+
|
|
37
|
+
class AuthorizationServiceClient:
|
|
38
|
+
def __init__(
|
|
39
|
+
self,
|
|
40
|
+
base_url: str,
|
|
41
|
+
http_client: urllib3.PoolManager | None = None,
|
|
42
|
+
protocol: ConnectProtocol = ConnectProtocol.CONNECT_PROTOBUF,
|
|
43
|
+
):
|
|
44
|
+
self.base_url = base_url
|
|
45
|
+
self._connect_client = ConnectClient(http_client, protocol)
|
|
46
|
+
def call_get_decisions(
|
|
47
|
+
self, req: authorization.authorization_pb2.GetDecisionsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
48
|
+
) -> UnaryOutput[authorization.authorization_pb2.GetDecisionsResponse]:
|
|
49
|
+
"""Low-level method to call GetDecisions, granting access to errors and metadata"""
|
|
50
|
+
url = self.base_url + "/authorization.AuthorizationService/GetDecisions"
|
|
51
|
+
return self._connect_client.call_unary(url, req, authorization.authorization_pb2.GetDecisionsResponse,extra_headers, timeout_seconds)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def get_decisions(
|
|
55
|
+
self, req: authorization.authorization_pb2.GetDecisionsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
56
|
+
) -> authorization.authorization_pb2.GetDecisionsResponse:
|
|
57
|
+
response = self.call_get_decisions(req, extra_headers, timeout_seconds)
|
|
58
|
+
err = response.error()
|
|
59
|
+
if err is not None:
|
|
60
|
+
raise err
|
|
61
|
+
msg = response.message()
|
|
62
|
+
if msg is None:
|
|
63
|
+
raise ConnectProtocolError('missing response message')
|
|
64
|
+
return msg
|
|
65
|
+
|
|
66
|
+
def call_get_decisions_by_token(
|
|
67
|
+
self, req: authorization.authorization_pb2.GetDecisionsByTokenRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
68
|
+
) -> UnaryOutput[authorization.authorization_pb2.GetDecisionsByTokenResponse]:
|
|
69
|
+
"""Low-level method to call GetDecisionsByToken, granting access to errors and metadata"""
|
|
70
|
+
url = self.base_url + "/authorization.AuthorizationService/GetDecisionsByToken"
|
|
71
|
+
return self._connect_client.call_unary(url, req, authorization.authorization_pb2.GetDecisionsByTokenResponse,extra_headers, timeout_seconds)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def get_decisions_by_token(
|
|
75
|
+
self, req: authorization.authorization_pb2.GetDecisionsByTokenRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
76
|
+
) -> authorization.authorization_pb2.GetDecisionsByTokenResponse:
|
|
77
|
+
response = self.call_get_decisions_by_token(req, extra_headers, timeout_seconds)
|
|
78
|
+
err = response.error()
|
|
79
|
+
if err is not None:
|
|
80
|
+
raise err
|
|
81
|
+
msg = response.message()
|
|
82
|
+
if msg is None:
|
|
83
|
+
raise ConnectProtocolError('missing response message')
|
|
84
|
+
return msg
|
|
85
|
+
|
|
86
|
+
def call_get_entitlements(
|
|
87
|
+
self, req: authorization.authorization_pb2.GetEntitlementsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
88
|
+
) -> UnaryOutput[authorization.authorization_pb2.GetEntitlementsResponse]:
|
|
89
|
+
"""Low-level method to call GetEntitlements, granting access to errors and metadata"""
|
|
90
|
+
url = self.base_url + "/authorization.AuthorizationService/GetEntitlements"
|
|
91
|
+
return self._connect_client.call_unary(url, req, authorization.authorization_pb2.GetEntitlementsResponse,extra_headers, timeout_seconds)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def get_entitlements(
|
|
95
|
+
self, req: authorization.authorization_pb2.GetEntitlementsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
96
|
+
) -> authorization.authorization_pb2.GetEntitlementsResponse:
|
|
97
|
+
response = self.call_get_entitlements(req, extra_headers, timeout_seconds)
|
|
98
|
+
err = response.error()
|
|
99
|
+
if err is not None:
|
|
100
|
+
raise err
|
|
101
|
+
msg = response.message()
|
|
102
|
+
if msg is None:
|
|
103
|
+
raise ConnectProtocolError('missing response message')
|
|
104
|
+
return msg
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class AsyncAuthorizationServiceClient:
|
|
108
|
+
def __init__(
|
|
109
|
+
self,
|
|
110
|
+
base_url: str,
|
|
111
|
+
http_client: aiohttp.ClientSession,
|
|
112
|
+
protocol: ConnectProtocol = ConnectProtocol.CONNECT_PROTOBUF,
|
|
113
|
+
):
|
|
114
|
+
self.base_url = base_url
|
|
115
|
+
self._connect_client = AsyncConnectClient(http_client, protocol)
|
|
116
|
+
|
|
117
|
+
async def call_get_decisions(
|
|
118
|
+
self, req: authorization.authorization_pb2.GetDecisionsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
119
|
+
) -> UnaryOutput[authorization.authorization_pb2.GetDecisionsResponse]:
|
|
120
|
+
"""Low-level method to call GetDecisions, granting access to errors and metadata"""
|
|
121
|
+
url = self.base_url + "/authorization.AuthorizationService/GetDecisions"
|
|
122
|
+
return await self._connect_client.call_unary(url, req, authorization.authorization_pb2.GetDecisionsResponse,extra_headers, timeout_seconds)
|
|
123
|
+
|
|
124
|
+
async def get_decisions(
|
|
125
|
+
self, req: authorization.authorization_pb2.GetDecisionsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
126
|
+
) -> authorization.authorization_pb2.GetDecisionsResponse:
|
|
127
|
+
response = await self.call_get_decisions(req, extra_headers, timeout_seconds)
|
|
128
|
+
err = response.error()
|
|
129
|
+
if err is not None:
|
|
130
|
+
raise err
|
|
131
|
+
msg = response.message()
|
|
132
|
+
if msg is None:
|
|
133
|
+
raise ConnectProtocolError('missing response message')
|
|
134
|
+
return msg
|
|
135
|
+
|
|
136
|
+
async def call_get_decisions_by_token(
|
|
137
|
+
self, req: authorization.authorization_pb2.GetDecisionsByTokenRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
138
|
+
) -> UnaryOutput[authorization.authorization_pb2.GetDecisionsByTokenResponse]:
|
|
139
|
+
"""Low-level method to call GetDecisionsByToken, granting access to errors and metadata"""
|
|
140
|
+
url = self.base_url + "/authorization.AuthorizationService/GetDecisionsByToken"
|
|
141
|
+
return await self._connect_client.call_unary(url, req, authorization.authorization_pb2.GetDecisionsByTokenResponse,extra_headers, timeout_seconds)
|
|
142
|
+
|
|
143
|
+
async def get_decisions_by_token(
|
|
144
|
+
self, req: authorization.authorization_pb2.GetDecisionsByTokenRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
145
|
+
) -> authorization.authorization_pb2.GetDecisionsByTokenResponse:
|
|
146
|
+
response = await self.call_get_decisions_by_token(req, extra_headers, timeout_seconds)
|
|
147
|
+
err = response.error()
|
|
148
|
+
if err is not None:
|
|
149
|
+
raise err
|
|
150
|
+
msg = response.message()
|
|
151
|
+
if msg is None:
|
|
152
|
+
raise ConnectProtocolError('missing response message')
|
|
153
|
+
return msg
|
|
154
|
+
|
|
155
|
+
async def call_get_entitlements(
|
|
156
|
+
self, req: authorization.authorization_pb2.GetEntitlementsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
157
|
+
) -> UnaryOutput[authorization.authorization_pb2.GetEntitlementsResponse]:
|
|
158
|
+
"""Low-level method to call GetEntitlements, granting access to errors and metadata"""
|
|
159
|
+
url = self.base_url + "/authorization.AuthorizationService/GetEntitlements"
|
|
160
|
+
return await self._connect_client.call_unary(url, req, authorization.authorization_pb2.GetEntitlementsResponse,extra_headers, timeout_seconds)
|
|
161
|
+
|
|
162
|
+
async def get_entitlements(
|
|
163
|
+
self, req: authorization.authorization_pb2.GetEntitlementsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
164
|
+
) -> authorization.authorization_pb2.GetEntitlementsResponse:
|
|
165
|
+
response = await self.call_get_entitlements(req, extra_headers, timeout_seconds)
|
|
166
|
+
err = response.error()
|
|
167
|
+
if err is not None:
|
|
168
|
+
raise err
|
|
169
|
+
msg = response.message()
|
|
170
|
+
if msg is None:
|
|
171
|
+
raise ConnectProtocolError('missing response message')
|
|
172
|
+
return msg
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
@typing.runtime_checkable
|
|
176
|
+
class AuthorizationServiceProtocol(typing.Protocol):
|
|
177
|
+
def get_decisions(self, req: ClientRequest[authorization.authorization_pb2.GetDecisionsRequest]) -> ServerResponse[authorization.authorization_pb2.GetDecisionsResponse]:
|
|
178
|
+
...
|
|
179
|
+
def get_decisions_by_token(self, req: ClientRequest[authorization.authorization_pb2.GetDecisionsByTokenRequest]) -> ServerResponse[authorization.authorization_pb2.GetDecisionsByTokenResponse]:
|
|
180
|
+
...
|
|
181
|
+
def get_entitlements(self, req: ClientRequest[authorization.authorization_pb2.GetEntitlementsRequest]) -> ServerResponse[authorization.authorization_pb2.GetEntitlementsResponse]:
|
|
182
|
+
...
|
|
183
|
+
|
|
184
|
+
AUTHORIZATION_SERVICE_PATH_PREFIX = "/authorization.AuthorizationService"
|
|
185
|
+
|
|
186
|
+
def wsgi_authorization_service(implementation: AuthorizationServiceProtocol) -> WSGIApplication:
|
|
187
|
+
app = ConnectWSGI()
|
|
188
|
+
app.register_unary_rpc("/authorization.AuthorizationService/GetDecisions", implementation.get_decisions, authorization.authorization_pb2.GetDecisionsRequest)
|
|
189
|
+
app.register_unary_rpc("/authorization.AuthorizationService/GetDecisionsByToken", implementation.get_decisions_by_token, authorization.authorization_pb2.GetDecisionsByTokenRequest)
|
|
190
|
+
app.register_unary_rpc("/authorization.AuthorizationService/GetEntitlements", implementation.get_entitlements, authorization.authorization_pb2.GetEntitlementsRequest)
|
|
191
|
+
return app
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
|
+
# source: authorization/v2/authorization.proto
|
|
5
|
+
# Protobuf Python Version: 6.31.1
|
|
6
|
+
"""Generated protocol buffer code."""
|
|
7
|
+
from google.protobuf import descriptor as _descriptor
|
|
8
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
|
10
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
11
|
+
from google.protobuf.internal import builder as _builder
|
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
|
14
|
+
6,
|
|
15
|
+
31,
|
|
16
|
+
1,
|
|
17
|
+
'',
|
|
18
|
+
'authorization/v2/authorization.proto'
|
|
19
|
+
)
|
|
20
|
+
# @@protoc_insertion_point(imports)
|
|
21
|
+
|
|
22
|
+
_sym_db = _symbol_database.Default()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
from buf.validate import validate_pb2 as buf_dot_validate_dot_validate__pb2
|
|
26
|
+
from entity import entity_pb2 as entity_dot_entity__pb2
|
|
27
|
+
from google.protobuf import wrappers_pb2 as google_dot_protobuf_dot_wrappers__pb2
|
|
28
|
+
from policy import objects_pb2 as policy_dot_objects__pb2
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n$authorization/v2/authorization.proto\x12\x10\x61uthorization.v2\x1a\x1b\x62uf/validate/validate.proto\x1a\x13\x65ntity/entity.proto\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x14policy/objects.proto\"\x9a\x03\n\x10\x45ntityIdentifier\x12\xa2\x01\n\x0c\x65ntity_chain\x18\x01 \x01(\x0b\x32\x13.entity.EntityChainBh\xbaHe\xba\x01\x62\n\x15\x65ntity_chain_required\x12\x19\x65ntities must be provided\x1a.has(this.entities) && this.entities.size() > 0H\x00R\x0b\x65ntityChain\x12O\n\x1dregistered_resource_value_fqn\x18\x02 \x01(\tB\n\xbaH\x07r\x05\x10\x01\x88\x01\x01H\x00R\x1aregisteredResourceValueFqn\x12{\n\x05token\x18\x03 \x01(\x0b\x32\r.entity.TokenBT\xbaHQ\xba\x01N\n\x0etoken_required\x12\x16token must be provided\x1a$has(this.jwt) && this.jwt.size() > 0H\x00R\x05tokenB\x13\n\nidentifier\x12\x05\xbaH\x02\x08\x01\"\x81\x03\n\x12\x45ntityEntitlements\x12!\n\x0c\x65phemeral_id\x18\x01 \x01(\tR\x0b\x65phemeralId\x12\x8b\x01\n\x1f\x61\x63tions_per_attribute_value_fqn\x18\x02 \x03(\x0b\x32\x45.authorization.v2.EntityEntitlements.ActionsPerAttributeValueFqnEntryR\x1b\x61\x63tionsPerAttributeValueFqn\x1a\x37\n\x0b\x41\x63tionsList\x12(\n\x07\x61\x63tions\x18\x01 \x03(\x0b\x32\x0e.policy.ActionR\x07\x61\x63tions\x1a\x80\x01\n ActionsPerAttributeValueFqnEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x46\n\x05value\x18\x02 \x01(\x0b\x32\x30.authorization.v2.EntityEntitlements.ActionsListR\x05value:\x02\x38\x01\"\xa6\x03\n\x08Resource\x12!\n\x0c\x65phemeral_id\x18\x01 \x01(\tR\x0b\x65phemeralId\x12\xf2\x01\n\x10\x61ttribute_values\x18\x02 \x01(\x0b\x32*.authorization.v2.Resource.AttributeValuesB\x98\x01\xbaH\x94\x01\xba\x01\x90\x01\n\x19\x61ttribute_values_required\x12\x38if provided, resource.attribute_values must not be empty\x1a\x39this.fqns.size() > 0 && this.fqns.all(item, item.isUri())H\x00R\x0f\x61ttributeValues\x12O\n\x1dregistered_resource_value_fqn\x18\x03 \x01(\tB\n\xbaH\x07r\x05\x10\x01\x88\x01\x01H\x00R\x1aregisteredResourceValueFqn\x1a%\n\x0f\x41ttributeValues\x12\x12\n\x04\x66qns\x18\x01 \x03(\tR\x04\x66qnsB\n\n\x08resource\"~\n\x10ResourceDecision\x12\x32\n\x15\x65phemeral_resource_id\x18\x01 \x01(\tR\x13\x65phemeralResourceId\x12\x36\n\x08\x64\x65\x63ision\x18\x02 \x01(\x0e\x32\x1a.authorization.v2.DecisionR\x08\x64\x65\x63ision\"\xc4\x02\n\x12GetDecisionRequest\x12W\n\x11\x65ntity_identifier\x18\x01 \x01(\x0b\x32\".authorization.v2.EntityIdentifierB\x06\xbaH\x03\xc8\x01\x01R\x10\x65ntityIdentifier\x12.\n\x06\x61\x63tion\x18\x02 \x01(\x0b\x32\x0e.policy.ActionB\x06\xbaH\x03\xc8\x01\x01R\x06\x61\x63tion\x12>\n\x08resource\x18\x03 \x01(\x0b\x32\x1a.authorization.v2.ResourceB\x06\xbaH\x03\xc8\x01\x01R\x08resource:e\xbaHb\x1a`\n)get_decision_request.action_name_required\x12\x1c\x61\x63tion.name must be provided\x1a\x15has(this.action.name)\"U\n\x13GetDecisionResponse\x12>\n\x08\x64\x65\x63ision\x18\x01 \x01(\x0b\x32\".authorization.v2.ResourceDecisionR\x08\x64\x65\x63ision\"\xde\x02\n\x1fGetDecisionMultiResourceRequest\x12W\n\x11\x65ntity_identifier\x18\x01 \x01(\x0b\x32\".authorization.v2.EntityIdentifierB\x06\xbaH\x03\xc8\x01\x01R\x10\x65ntityIdentifier\x12.\n\x06\x61\x63tion\x18\x02 \x01(\x0b\x32\x0e.policy.ActionB\x06\xbaH\x03\xc8\x01\x01R\x06\x61\x63tion\x12\x45\n\tresources\x18\x03 \x03(\x0b\x32\x1a.authorization.v2.ResourceB\x0b\xbaH\x08\x92\x01\x02\x08\x01\xc8\x01\x01R\tresources:k\xbaHh\x1a\x66\n/get_decision_multi_request.action_name_required\x12\x1c\x61\x63tion.name must be provided\x1a\x15has(this.action.name)\"\xb6\x01\n GetDecisionMultiResourceResponse\x12?\n\rall_permitted\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.BoolValueR\x0c\x61llPermitted\x12Q\n\x12resource_decisions\x18\x02 \x03(\x0b\x32\".authorization.v2.ResourceDecisionR\x11resourceDecisions\"x\n\x16GetDecisionBulkRequest\x12^\n\x11\x64\x65\x63ision_requests\x18\x01 \x03(\x0b\x32\x31.authorization.v2.GetDecisionMultiResourceRequestR\x10\x64\x65\x63isionRequests\"|\n\x17GetDecisionBulkResponse\x12\x61\n\x12\x64\x65\x63ision_responses\x18\x01 \x03(\x0b\x32\x32.authorization.v2.GetDecisionMultiResourceResponseR\x11\x64\x65\x63isionResponses\"\xd9\x01\n\x16GetEntitlementsRequest\x12W\n\x11\x65ntity_identifier\x18\x01 \x01(\x0b\x32\".authorization.v2.EntityIdentifierB\x06\xbaH\x03\xc8\x01\x01R\x10\x65ntityIdentifier\x12\x45\n\x1cwith_comprehensive_hierarchy\x18\x02 \x01(\x08H\x00R\x1awithComprehensiveHierarchy\x88\x01\x01\x42\x1f\n\x1d_with_comprehensive_hierarchy\"c\n\x17GetEntitlementsResponse\x12H\n\x0c\x65ntitlements\x18\x01 \x03(\x0b\x32$.authorization.v2.EntityEntitlementsR\x0c\x65ntitlements*L\n\x08\x44\x65\x63ision\x12\x18\n\x14\x44\x45\x43ISION_UNSPECIFIED\x10\x00\x12\x11\n\rDECISION_DENY\x10\x01\x12\x13\n\x0f\x44\x45\x43ISION_PERMIT\x10\x02\x32\xce\x03\n\x14\x41uthorizationService\x12\\\n\x0bGetDecision\x12$.authorization.v2.GetDecisionRequest\x1a%.authorization.v2.GetDecisionResponse\"\x00\x12\x83\x01\n\x18GetDecisionMultiResource\x12\x31.authorization.v2.GetDecisionMultiResourceRequest\x1a\x32.authorization.v2.GetDecisionMultiResourceResponse\"\x00\x12h\n\x0fGetDecisionBulk\x12(.authorization.v2.GetDecisionBulkRequest\x1a).authorization.v2.GetDecisionBulkResponse\"\x00\x12h\n\x0fGetEntitlements\x12(.authorization.v2.GetEntitlementsRequest\x1a).authorization.v2.GetEntitlementsResponse\"\x00\x42\x8b\x01\n\x14\x63om.authorization.v2B\x12\x41uthorizationProtoP\x01\xa2\x02\x03\x41XX\xaa\x02\x10\x41uthorization.V2\xca\x02\x10\x41uthorization\\V2\xe2\x02\x1c\x41uthorization\\V2\\GPBMetadata\xea\x02\x11\x41uthorization::V2b\x06proto3')
|
|
32
|
+
|
|
33
|
+
_globals = globals()
|
|
34
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
35
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'authorization.v2.authorization_pb2', _globals)
|
|
36
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
37
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
|
38
|
+
_globals['DESCRIPTOR']._serialized_options = b'\n\024com.authorization.v2B\022AuthorizationProtoP\001\242\002\003AXX\252\002\020Authorization.V2\312\002\020Authorization\\V2\342\002\034Authorization\\V2\\GPBMetadata\352\002\021Authorization::V2'
|
|
39
|
+
_globals['_ENTITYIDENTIFIER'].oneofs_by_name['identifier']._loaded_options = None
|
|
40
|
+
_globals['_ENTITYIDENTIFIER'].oneofs_by_name['identifier']._serialized_options = b'\272H\002\010\001'
|
|
41
|
+
_globals['_ENTITYIDENTIFIER'].fields_by_name['entity_chain']._loaded_options = None
|
|
42
|
+
_globals['_ENTITYIDENTIFIER'].fields_by_name['entity_chain']._serialized_options = b'\272He\272\001b\n\025entity_chain_required\022\031entities must be provided\032.has(this.entities) && this.entities.size() > 0'
|
|
43
|
+
_globals['_ENTITYIDENTIFIER'].fields_by_name['registered_resource_value_fqn']._loaded_options = None
|
|
44
|
+
_globals['_ENTITYIDENTIFIER'].fields_by_name['registered_resource_value_fqn']._serialized_options = b'\272H\007r\005\020\001\210\001\001'
|
|
45
|
+
_globals['_ENTITYIDENTIFIER'].fields_by_name['token']._loaded_options = None
|
|
46
|
+
_globals['_ENTITYIDENTIFIER'].fields_by_name['token']._serialized_options = b'\272HQ\272\001N\n\016token_required\022\026token must be provided\032$has(this.jwt) && this.jwt.size() > 0'
|
|
47
|
+
_globals['_ENTITYENTITLEMENTS_ACTIONSPERATTRIBUTEVALUEFQNENTRY']._loaded_options = None
|
|
48
|
+
_globals['_ENTITYENTITLEMENTS_ACTIONSPERATTRIBUTEVALUEFQNENTRY']._serialized_options = b'8\001'
|
|
49
|
+
_globals['_RESOURCE'].fields_by_name['attribute_values']._loaded_options = None
|
|
50
|
+
_globals['_RESOURCE'].fields_by_name['attribute_values']._serialized_options = b'\272H\224\001\272\001\220\001\n\031attribute_values_required\0228if provided, resource.attribute_values must not be empty\0329this.fqns.size() > 0 && this.fqns.all(item, item.isUri())'
|
|
51
|
+
_globals['_RESOURCE'].fields_by_name['registered_resource_value_fqn']._loaded_options = None
|
|
52
|
+
_globals['_RESOURCE'].fields_by_name['registered_resource_value_fqn']._serialized_options = b'\272H\007r\005\020\001\210\001\001'
|
|
53
|
+
_globals['_GETDECISIONREQUEST'].fields_by_name['entity_identifier']._loaded_options = None
|
|
54
|
+
_globals['_GETDECISIONREQUEST'].fields_by_name['entity_identifier']._serialized_options = b'\272H\003\310\001\001'
|
|
55
|
+
_globals['_GETDECISIONREQUEST'].fields_by_name['action']._loaded_options = None
|
|
56
|
+
_globals['_GETDECISIONREQUEST'].fields_by_name['action']._serialized_options = b'\272H\003\310\001\001'
|
|
57
|
+
_globals['_GETDECISIONREQUEST'].fields_by_name['resource']._loaded_options = None
|
|
58
|
+
_globals['_GETDECISIONREQUEST'].fields_by_name['resource']._serialized_options = b'\272H\003\310\001\001'
|
|
59
|
+
_globals['_GETDECISIONREQUEST']._loaded_options = None
|
|
60
|
+
_globals['_GETDECISIONREQUEST']._serialized_options = b'\272Hb\032`\n)get_decision_request.action_name_required\022\034action.name must be provided\032\025has(this.action.name)'
|
|
61
|
+
_globals['_GETDECISIONMULTIRESOURCEREQUEST'].fields_by_name['entity_identifier']._loaded_options = None
|
|
62
|
+
_globals['_GETDECISIONMULTIRESOURCEREQUEST'].fields_by_name['entity_identifier']._serialized_options = b'\272H\003\310\001\001'
|
|
63
|
+
_globals['_GETDECISIONMULTIRESOURCEREQUEST'].fields_by_name['action']._loaded_options = None
|
|
64
|
+
_globals['_GETDECISIONMULTIRESOURCEREQUEST'].fields_by_name['action']._serialized_options = b'\272H\003\310\001\001'
|
|
65
|
+
_globals['_GETDECISIONMULTIRESOURCEREQUEST'].fields_by_name['resources']._loaded_options = None
|
|
66
|
+
_globals['_GETDECISIONMULTIRESOURCEREQUEST'].fields_by_name['resources']._serialized_options = b'\272H\010\222\001\002\010\001\310\001\001'
|
|
67
|
+
_globals['_GETDECISIONMULTIRESOURCEREQUEST']._loaded_options = None
|
|
68
|
+
_globals['_GETDECISIONMULTIRESOURCEREQUEST']._serialized_options = b'\272Hh\032f\n/get_decision_multi_request.action_name_required\022\034action.name must be provided\032\025has(this.action.name)'
|
|
69
|
+
_globals['_GETENTITLEMENTSREQUEST'].fields_by_name['entity_identifier']._loaded_options = None
|
|
70
|
+
_globals['_GETENTITLEMENTSREQUEST'].fields_by_name['entity_identifier']._serialized_options = b'\272H\003\310\001\001'
|
|
71
|
+
_globals['_DECISION']._serialized_start=3037
|
|
72
|
+
_globals['_DECISION']._serialized_end=3113
|
|
73
|
+
_globals['_ENTITYIDENTIFIER']._serialized_start=163
|
|
74
|
+
_globals['_ENTITYIDENTIFIER']._serialized_end=573
|
|
75
|
+
_globals['_ENTITYENTITLEMENTS']._serialized_start=576
|
|
76
|
+
_globals['_ENTITYENTITLEMENTS']._serialized_end=961
|
|
77
|
+
_globals['_ENTITYENTITLEMENTS_ACTIONSLIST']._serialized_start=775
|
|
78
|
+
_globals['_ENTITYENTITLEMENTS_ACTIONSLIST']._serialized_end=830
|
|
79
|
+
_globals['_ENTITYENTITLEMENTS_ACTIONSPERATTRIBUTEVALUEFQNENTRY']._serialized_start=833
|
|
80
|
+
_globals['_ENTITYENTITLEMENTS_ACTIONSPERATTRIBUTEVALUEFQNENTRY']._serialized_end=961
|
|
81
|
+
_globals['_RESOURCE']._serialized_start=964
|
|
82
|
+
_globals['_RESOURCE']._serialized_end=1386
|
|
83
|
+
_globals['_RESOURCE_ATTRIBUTEVALUES']._serialized_start=1337
|
|
84
|
+
_globals['_RESOURCE_ATTRIBUTEVALUES']._serialized_end=1374
|
|
85
|
+
_globals['_RESOURCEDECISION']._serialized_start=1388
|
|
86
|
+
_globals['_RESOURCEDECISION']._serialized_end=1514
|
|
87
|
+
_globals['_GETDECISIONREQUEST']._serialized_start=1517
|
|
88
|
+
_globals['_GETDECISIONREQUEST']._serialized_end=1841
|
|
89
|
+
_globals['_GETDECISIONRESPONSE']._serialized_start=1843
|
|
90
|
+
_globals['_GETDECISIONRESPONSE']._serialized_end=1928
|
|
91
|
+
_globals['_GETDECISIONMULTIRESOURCEREQUEST']._serialized_start=1931
|
|
92
|
+
_globals['_GETDECISIONMULTIRESOURCEREQUEST']._serialized_end=2281
|
|
93
|
+
_globals['_GETDECISIONMULTIRESOURCERESPONSE']._serialized_start=2284
|
|
94
|
+
_globals['_GETDECISIONMULTIRESOURCERESPONSE']._serialized_end=2466
|
|
95
|
+
_globals['_GETDECISIONBULKREQUEST']._serialized_start=2468
|
|
96
|
+
_globals['_GETDECISIONBULKREQUEST']._serialized_end=2588
|
|
97
|
+
_globals['_GETDECISIONBULKRESPONSE']._serialized_start=2590
|
|
98
|
+
_globals['_GETDECISIONBULKRESPONSE']._serialized_end=2714
|
|
99
|
+
_globals['_GETENTITLEMENTSREQUEST']._serialized_start=2717
|
|
100
|
+
_globals['_GETENTITLEMENTSREQUEST']._serialized_end=2934
|
|
101
|
+
_globals['_GETENTITLEMENTSRESPONSE']._serialized_start=2936
|
|
102
|
+
_globals['_GETENTITLEMENTSRESPONSE']._serialized_end=3035
|
|
103
|
+
_globals['_AUTHORIZATIONSERVICE']._serialized_start=3116
|
|
104
|
+
_globals['_AUTHORIZATIONSERVICE']._serialized_end=3578
|
|
105
|
+
# @@protoc_insertion_point(module_scope)
|