Skip to main content

gRPC client for Aserto Authorizer service instances

Project description

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

Using Poetry

poetry add aserto-authorizer

Usage

from aserto_authorizer.aserto.authorizer.v2.api import (
    IdentityContext,
    IdentityType,
    PolicyContext,
)
from aserto_authorizer.aserto.authorizer.v2 import (
    AuthorizerStub,
    DecisionTreeOptions,
    DecisionTreeResponse,
    PathSeparator,
)
from grpclib.client import Channel


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

    client = AuthorizerStub(channel, metadata=headers)

    response = await client.decision_tree(
        policy_context=PolicyContext(
            name=ASERTO_POLICY_NAME,
            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),
                        },
                    ),
                ),
            },
        ),
    )

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aserto_authorizer-0.0.1.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

aserto_authorizer-0.0.1-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

Details for the file aserto_authorizer-0.0.1.tar.gz.

File metadata

  • Download URL: aserto_authorizer-0.0.1.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for aserto_authorizer-0.0.1.tar.gz
Algorithm Hash digest
SHA256 7d8ad8e4a8c42618b76ec73b240eef8d3a7fbad5ab845dbea96f08142b5c2866
MD5 4377ee41682bec49cfb4ca717a4103f8
BLAKE2b-256 79a63fe8a32d6efa6e042c64ce784beaa1faa30b58c8b3ae593d36ec53fe43b0

See more details on using hashes here.

File details

Details for the file aserto_authorizer-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for aserto_authorizer-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 165f00695f9a22c7b2823fd9b740ec0133ab993e57b9b25ca5f0a8c912a2cea4
MD5 e6a821da322811a6a9865909bd88ebdd
BLAKE2b-256 b911689e52b5f366cfe373fc08a07864897d71b6e8704e2fa379866fb42ee95a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page