Skip to content

feat: Implement initial classes for authentication system and tests - #5

Merged
AriasBros merged 17 commits into
devfrom
feat/authz
Aug 3, 2026
Merged

feat: Implement initial classes for authentication system and tests#5
AriasBros merged 17 commits into
devfrom
feat/authz

Conversation

@AriasBros

Copy link
Copy Markdown
Contributor

This pull request introduces a comprehensive authentication and authorization system to Pyrannic, including new core classes, configuration structures, and documentation. The main changes are the addition of guards, user providers, and authorization mechanisms (gates and policies), as well as updates to the documentation and public API.

Authentication System

  • Introduced BaseGuard and BearerGuard classes to handle authentication logic and HTTP Bearer token authentication, respectively. [1] [2]
  • Added configuration classes GuardsConfig and UserProvidersConfig for customizable authentication drivers and user providers. [1] [2]
  • Added Authenticatable base class for user entities.

Authorization System

  • Introduced Gate and Authorizable classes to provide flexible authorization checks using gates and policies, including support for defining abilities and policies, and model-based authorization. [1] [2]
  • Added Response class to standardize authorization outcomes and exception handling.
  • Added ForbiddenException and UnauthorizedException for consistent error signaling.

Public API and Integration

  • Updated pyrannic/__init__.py to expose new authentication and authorization classes as part of the public API.
  • Added imports in pyrannic/auth/__init__.py to facilitate easier access to new classes.

Documentation

  • Added new documentation pages for authentication and authorization, outlining the concepts of guards, user providers, gates, and policies. [1] [2]
  • Updated mkdocs.yml navigation to include new security documentation sections.

These changes lay the groundwork for robust, extensible authentication and authorization in Pyrannic, with clear documentation and configuration options for end users.

@github-code-quality

github-code-quality Bot commented Aug 3, 2026

Copy link
Copy Markdown

Code Coverage Overview

Languages: Python

Python / code-coverage/pytest

The overall coverage in commit 460d4b8 in the feat/authz branch is 91%. The coverage in commit 82d8151 in the dev branch is 88%.

Show a code coverage summary of the most impacted files.
File dev 82d8151 feat/authz 460d4b8 +/-
auth/access/gate.py 0% 89% +89%
auth/access/response.py 0% 100% +100%
auth/base_guard.py 0% 100% +100%
orm/sqlalchemy/provider.py 0% 100% +100%
auth/safeguard.py 0% 100% +100%
auth/access/authorizable.py 0% 100% +100%
auth/bearer_guard.py 0% 100% +100%
auth/service_provider.py 0% 100% +100%
auth/config/guards_config.py 0% 100% +100%
auth/config/use...iders_config.py 0% 100% +100%

Updated August 03, 2026 08:33 UTC

@AriasBros
AriasBros merged commit 002dd05 into dev Aug 3, 2026
3 checks passed
@AriasBros
AriasBros deleted the feat/authz branch August 3, 2026 08:34
@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.97701% with 14 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
pyrannic/auth/access/gate.py 88.97% 14 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant