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.4.tar.gz (38.9 kB view details)

Uploaded Source

Built Distribution

aserto_authorizer-0.0.4-py3-none-any.whl (54.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aserto_authorizer-0.0.4.tar.gz
  • Upload date:
  • Size: 38.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.7.12 Darwin/21.6.0

File hashes

Hashes for aserto_authorizer-0.0.4.tar.gz
Algorithm Hash digest
SHA256 bd68d0753bacde8ad4676c966c8b361aedcdf4f4ca99167f5c2d33065e5a2c3f
MD5 02a9f5f147d4a4bbd2159e0f0370640c
BLAKE2b-256 104b5478cbc75dd2cc051006f9dba424d351e971d711f11304b9d03bf0d0edb8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aserto_authorizer-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 41ef7799e33f55c518e96de9086ffae074737d472405bcde723af2f1bb99076e
MD5 2f2a68e6788bb1aebf67232b29b90086
BLAKE2b-256 f3662e99d35120aeebc3947a6546f59082121c4db0391efd99693ac418df1ebd

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