-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from hivesolutions/src/netius/auth
feat: add src/netius/auth to typing
- Loading branch information
Showing
8 changed files
with
98 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from typing import Sequence | ||
|
||
from netius import Auth | ||
|
||
class AddressAuth(Auth): | ||
def __init__(self, allowed: Sequence[str] = ..., *args, **kwargs) -> None: ... | ||
@classmethod | ||
def auth(cls, allowed: Sequence[str] = ..., *args, **kwargs) -> bool: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from netius import Auth | ||
|
||
class AllowAuth(Auth): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,27 @@ | ||
from typing import Literal | ||
from typing import Any, Literal, NoReturn, PathLike | ||
|
||
HashType = Literal["plain", "md5", "sha1", "sha256", "sha512"] | ||
HashType = Literal["plain", "md5", "sha1", "sha256", "sha512"] | ||
|
||
class Auth(object): | ||
class Auth: | ||
def __init__(self, *args, **kwargs) -> None: ... | ||
@classmethod | ||
def auth(cls, *args, **kwargs) -> bool: ... | ||
@classmethod | ||
def meta(cls, *args, **kwargs) -> dict[str, Any]: ... | ||
@classmethod | ||
def auth_assert(cls, *args, **kwargs) -> NoReturn: ... | ||
@classmethod | ||
def verify(cls, encoded: str, decoded: str) -> bool: ... | ||
|
||
@classmethod | ||
def generate(cls, password: str, type: HashType = ..., salt: str = ...) -> str: ... | ||
|
||
@classmethod | ||
def unpack(cls, password: str) -> tuple[HashType, str, str, str]: ... | ||
def unpack(cls, password) -> tuple[HashType, str | None, str, str | None]: ... | ||
@classmethod | ||
def get_file( | ||
cls, path: PathLike[str], cache: bool = ..., encoding: str | None = ... | ||
) -> str | bytes: ... | ||
@classmethod | ||
def is_simple(cls) -> bool: ... | ||
def auth_i(self, *args, **kwargs) -> bool: ... | ||
def auth_assert_i(self, *args, **kwargs) -> NoReturn: ... | ||
def is_simple_i(self) -> bool: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from netius import Auth | ||
|
||
class DenyAuth(Auth): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from netius import Auth | ||
|
||
class DummyAuth(Auth): | ||
def __init__(self, value: bool = ..., *args, **kwargs) -> None: ... | ||
@classmethod | ||
def auth(cls, value: bool = ..., *args, **kwargs) -> bool: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from typing import Any | ||
|
||
from netius import Auth | ||
|
||
class MemoryAuth(Auth): | ||
def __init__( | ||
self, registry: dict[str, Any] | None = ..., *args, **kwargs | ||
) -> None: ... | ||
@classmethod | ||
def auth( | ||
cls, | ||
username: str, | ||
password: str, | ||
registry: dict[str, Any] | None = ..., | ||
*args, | ||
**kwargs | ||
) -> bool: ... | ||
@classmethod | ||
def meta( | ||
cls, username: str, registry: dict[str, Any] | None = ..., *args, **kwargs | ||
) -> dict[str, Any]: ... | ||
@classmethod | ||
def get_registry(cls) -> dict[str, Any]: ... | ||
@classmethod | ||
def load_registry(cls) -> dict[str, Any]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from typing import PathLike | ||
|
||
from netius import Auth | ||
|
||
class PasswdAuth(Auth): | ||
def __init__(self, path: PathLike[str] | None = ..., *args, **kwargs) -> None: ... | ||
@classmethod | ||
def auth( | ||
cls, username: str, password: str, path: str = ..., *args, **kwargs | ||
) -> bool: ... | ||
@classmethod | ||
def get_passwd(cls, path: PathLike[str], cache: bool = ...) -> dict[str, str]: ... | ||
def auth_i(self, username: str, password: str, *args, **kwargs) -> bool: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from typing import Sequence | ||
|
||
from netius import Auth | ||
|
||
class SimpleAuth(Auth): | ||
def __init__( | ||
self, username: str | None = ..., password: str | None = ..., *args, **kwargs | ||
) -> None: ... | ||
@classmethod | ||
def auth( | ||
cls, | ||
username: str, | ||
password: str, | ||
target: Sequence[str, str] | None = ..., | ||
*args, | ||
**kwargs | ||
) -> bool: ... | ||
def auth_i(self, username: str, password: str, *args, **kwargs) -> bool: ... |