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

Uploaded Source

Built Distribution

aserto_authorizer-0.20.3-py3-none-any.whl (44.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aserto_authorizer-0.20.3.tar.gz
  • Upload date:
  • Size: 26.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.14 Linux/6.5.0-1022-azure

File hashes

Hashes for aserto_authorizer-0.20.3.tar.gz
Algorithm Hash digest
SHA256 f409327ded09bd1cf4ff281f119506a5a3e7125c31dc9be8d79ddd0fa7503200
MD5 2fc3d2bfbc44315c4bd8f937d31f10f4
BLAKE2b-256 ac11516d0518a91ca5d6392eb86116b74939b0ec99fad04cd021b675f91eae45

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aserto_authorizer-0.20.3-py3-none-any.whl
  • Upload date:
  • Size: 44.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.14 Linux/6.5.0-1022-azure

File hashes

Hashes for aserto_authorizer-0.20.3-py3-none-any.whl
Algorithm Hash digest
SHA256 32413b840c0d3c4358d7d8b50e655947c919b973fd2139ec5ee278cc4bbbcef0
MD5 630a20efd98f203efabe1dc54ec39a1a
BLAKE2b-256 59ae6dfc5f28384a0b8dcfe4a5e374ed66ae3933d48ca8b4c78422596edbe88d

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