Skip to main content

Aserto Authorizer gRPC client

This is an automatically generated client for interacting with Aserto's Authorizer service using the gRPC protocol.

Installation

Using Pip

pip install aserto-authorizer-grpc

Using Poetry

poetry add aserto-authorizer-grpc

Usage

from aserto_authorizer_grpc.aserto.api.v1 import (
    IdentityContext,
    IdentityType,
    PolicyContext,
)
from aserto_authorizer_grpc.aserto.authorizer.authorizer.v1 import (
    AuthorizerStub,
    DecisionTreeOptions,
    DecisionTreeResponse,
    PathSeparator,
    Proto,
)
from grpclib.client import Channel


async with Channel(host=host, port=port, ssl=True) as channel:
    headers = {
        "aserto-tenant-id": TENANT_ID,
        "authorization": f"basic {ASERTO_API_KEY}"
    }

    client = AuthorizerStub(channel, metadata=headers)

    response = await client.decision_tree(
        policy_context=PolicyContext(
            id=ASERTO_POLICY_ID,
            path=ASERTO_POLICY_PATH_ROOT,
            decisions=["visible", "enabled", "allowed"],
        ),
        identity_context=IdentityContext(type=IdentityType.IDENTITY_TYPE_NONE),
        resource_context=Proto.Struct(),
        options=DecisionTreeOptions(
            path_separator=PathSeparator.PATH_SEPARATOR_DOT,
        ),
    )

    assert response == DecisionTreeResponse(
        path_root=ASERTO_POLICY_PATH_ROOT,
        path=Proto.Struct(
            fields={
                "GET.your.policy.path": Proto.Value(
                    struct_value=Proto.Struct(
                        fields={
                            "visible": Proto.Value(bool_value=True),
                            "enabled": Proto.Value(bool_value=True),
                            "allowed": Proto.Value(bool_value=False),
                        },
                    ),
                ),
            },
        ),
    )

Metadata

Release files for aserto-authorizer-grpc 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aserto-authorizer-grpc 0.3.1
File Size Uploaded
aserto-authorizer-grpc-0.3.1.tar.gz 15.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aserto-authorizer-grpc 0.3.1
File Interpreter ABI Platform
aserto_authorizer_grpc-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 33.7 kB

Release files / aserto-authorizer-grpc-0.3.1.tar.gz

Download URL aserto-authorizer-grpc-0.3.1.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b10b6622f5b1929f0f12c3c00b73af2df0cbb182d5167143cfa93470f4a18d9a
BLAKE2b-256 checksum
How to use checksums
bedcdd449acda6d1acadf08145afcaff1ba538ad4170113b437f93bbbc8a8836
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.8 CPython/3.7.12 Darwin/21.1.0

Release files / aserto_authorizer_grpc-0.3.1-py3-none-any.whl

Download URL aserto_authorizer_grpc-0.3.1-py3-none-any.whl
Size 18.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
74f4562eb13192723ea717cac7d2e34da235e735afba59557aec711b90c6dbaf
BLAKE2b-256 checksum
How to use checksums
f7e9cd26f2f4c475a3257cbc1d3ed15d95acd02a6de0abb9293e2356942adb53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.8 CPython/3.7.12 Darwin/21.1.0

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page