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.2rc1.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for aserto_authorizer-0.20.2rc1.tar.gz
Algorithm Hash digest
SHA256 ea9b8ed09af426b8d3a276014896ae90400da393a51dba7fd33c877dade1e9e3
MD5 7b6e45e9ce51dfe0dd58b08c34ee3060
BLAKE2b-256 501602cef5d497ac6cbe650ae32a7404569a489682f39cbf067d59a22b3c859f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aserto_authorizer-0.20.2rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 7b82a5646c932e241e8fff4e51faa97348ca8b2f804a95215812e577f6e1ef81
MD5 baa3cb135033089c8a1d25f63cca20e7
BLAKE2b-256 5ef2afd0018df646eaf6896bc4a89220ebf96906aee9d2a9f910681a93a51fec

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