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

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


with grpc.secure_channel(
    target="authorizer.prod.aserto.com:8443",
    credentials=grpc.ssl_channel_credentials(),
) as channel:
    client = AuthorizerStub(channel)

    response = client.DecisionTree(
        DecisionTreeRequest(
            policy_context=PolicyContext(
                path=ASERTO_POLICY_PATH_ROOT,
                decisions=["visible", "enabled", "allowed"],
            ),
            policy_instance=PolicyInstance(
                name=ASERTO_POLICY_NAME,
                instance_label=ASERTO_POLICY_INSTANCE_LABEL,
            ),
            identity_context=IdentityContext(type=IdentityType.IDENTITY_TYPE_NONE),
            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.20.2.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

aserto_authorizer-0.20.2-py3-none-any.whl (43.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aserto_authorizer-0.20.2.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.13 Linux/6.2.0-1016-azure

File hashes

Hashes for aserto_authorizer-0.20.2.tar.gz
Algorithm Hash digest
SHA256 798e4712bd9bb78fec159c673eb96bda8a52150813da5dcd89e8b3e849b2e39e
MD5 3289ef2e97ea6c6ca057be833d907807
BLAKE2b-256 0923873c6d1b3b6cc6695bf9562d6a63e10ef61b3673e0474d48cffdc8faebfe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aserto_authorizer-0.20.2-py3-none-any.whl
  • Upload date:
  • Size: 43.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.13 Linux/6.2.0-1016-azure

File hashes

Hashes for aserto_authorizer-0.20.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ec72504785406978b77a46ba8baa187a56b7b52759bbaf3cf1887d4f1989fa05
MD5 bbd4962d8d701821a51a50673b0dc051
BLAKE2b-256 ef1aa23566e0adaebc18f32b8571ad0ac662552758e0f8667fa46c71b36c97c6

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