Skip to main content

paig-authorizer-core

Overview

paig-authorizer-core is a Python library designed to provide a framework of interfaces and abstract classes for building custom authorization implementations. This library allows developers to define their own authorization logic while ensuring consistency and structure.

Features

  • Provides a set of interfaces and abstract classes.
  • Customizable implementations for various authorization scenarios.
  • Easy to extend and integrate into existing applications.

Installation

You can install the library using pip:

pip install paig-authorizer-core

Usage

To use the paig-authorizer-core library, follow these steps:

  1. Import the required classes:

    from paig_authorizer_core import BasePAIGAuthorizer
    from paig_authorizer_core.models.request_models import AuthzRequest, VectorDBAuthzRequest
    
  2. Create a custom authorizer class: Implement your own authorizer by extending the BasePAIGAuthorizer class:

    class MyCustomAuthorizer(BasePAIGAuthorizer):
        def get_user_id_by_email(self, email: str) -> Optional[str]:
            # Implementation to retrieve user ID by email
            pass
        
        def get_user_groups(self, user: str) -> List[str]:
            # Implementation to retrieve user groups
            pass
    
        # Implement other abstract methods...
    
  3. Instantiate your custom authorizer:

    authorizer = MyCustomAuthorizer()
    
  4. Create an authorization request:

    authz_request = AuthzRequest(
        user_id="user@example.com",
        application_key="MyApp",
        traits=["trait1"],
        request_type="access"
    )
    
  5. Authorize the request: Call the authorize method to check if the request is authorized:

    response = authorizer.authorize(authz_request)
    print(f"Authorization response: {response}")
    
  6. Create a VectorDB authorization request:

    vector_db_request = VectorDBAuthzRequest(
        user_id="admin@example.com",
        application_key="MyApp"
    )
    
  7. Authorize the VectorDB request: Call the authorize_vector_db method to check VectorDB access:

    vector_db_response = authorizer.authorize_vector_db(vector_db_request)
    print(f"VectorDB authorization response: {vector_db_response}")
    

Metadata

Release files for paig-authorizer-core 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for paig-authorizer-core 0.0.3
File Interpreter ABI Platform Actions
paig_authorizer_core-0.0.3-py3-none-any.whl Python 3 none any Details for paig_authorizer_core-0.0.3-py3-none-any.whl

Release files / paig_authorizer_core-0.0.3-py3-none-any.whl

Download URL paig_authorizer_core-0.0.3-py3-none-any.whl
Size 25.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a6dd132e022f1f092b41a563a7191f793bdf24dc8a7fdf6805b00e6553b59baa
BLAKE2b-256 checksum
How to use checksums
8a700c5aaf347f3bfe13ae96cca6a801d2424dea65fe28d057ce89b42de59993
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.17

Security for paig-authorizer-core 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page