pigauth package

Submodules

pigauth.cli module

pigauth.pigauth module

Module contents

Python Authorization Helper.

class pigauth.MatchContext[source]

Bases: SimpleNamespace

MatchContext is passed to matchers

class pigauth.Permission(permission_id: str, requires: list = <factory>)[source]

Bases: object

Describe permission

permission_id: str
requires: list
class pigauth.PermissionGrantParser(expression_parser: Parser | None = None)[source]

Bases: object

Parse permission grant into a single PermissionMatcher

class pigauth.PermissionGrantsParser(permission_grant_parser: Parser | None = None)[source]

Bases: object

Parse multiple permission grants into a single PermissionMatcher

class pigauth.Resolver(scheme: Scheme)[source]

Bases: object

Resolve effective grants against authorization scheme

resolve(permission_grants: Iterable[str], role_grants: Iterable[str]) Iterable[str][source]

Resolve effective permission grants

resolve_roles(role_grants: Iterable[str]) Iterable[str][source]

Resolve effective role grants

scheme: Scheme
class pigauth.Role(role_id: str, grants: ~typing.Iterable[str] = <factory>, is_default: bool = False)[source]

Bases: object

Describe authorization role

grants: Iterable[str]
is_default: bool = False
role_id: str
class pigauth.Scheme(roles: ~typing.Dict[str, ~pigauth._auth.Role] = <factory>, permissions: ~typing.Dict[str, ~pigauth._auth.Permission] = <factory>)[source]

Bases: object

Describe authorization scheme

add_permission(permission: Permission)[source]
add_role(role: Role)[source]
permissions: Dict[str, Permission]
roles: Dict[str, Role]