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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: aserto_authorizer-0.20.0.tar.gz
  • Upload date:
  • Size: 38.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.8 Linux/5.15.0-1022-azure

File hashes

Hashes for aserto_authorizer-0.20.0.tar.gz
Algorithm Hash digest
SHA256 6302026e1d6be0200c391c5a44fdbda9a7361abedcedec5d637a05dc21d39ef6
MD5 7a21b9f13d997064bf3fa272c44952ee
BLAKE2b-256 86d9789d5e7f7ecbe6b6acbd4c55fd3800bf682d2b8b354ca1cab0c29e87fc6c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aserto_authorizer-0.20.0-py3-none-any.whl
  • Upload date:
  • Size: 54.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.8 Linux/5.15.0-1022-azure

File hashes

Hashes for aserto_authorizer-0.20.0-py3-none-any.whl
Algorithm Hash digest
SHA256 11fe50443dd6c86c5c47bb92d08addc79e92a3bfe90e55886980b6bb03045277
MD5 7f771b67350e1dd471cfa3922b3467ca
BLAKE2b-256 4b7af50cfb39d2457d3262ed9098166266113231171fc921ee42d63d76106a35

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