Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions flask_httpauth-stubs/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
from typing import (
Callable,
List,
Optional,
Tuple,
Union,
)
from werkzeug.datastructures import Authorization

RoleType = Optional[Union[str, List[str], List[List[str]]]]


class HTTPAuth:
def __init__(
self,
Expand All @@ -28,7 +31,7 @@ class HTTPAuth:
def authenticate_header(self) -> str: ...
def authorize(
self,
role: Optional[Union[Tuple[str, str], Tuple[Tuple[str, str]], str]],
role: RoleType,
user: Union[str, bool],
auth: Optional[Authorization],
) -> Optional[bool]: ...
Expand All @@ -41,7 +44,7 @@ class HTTPAuth:
def login_required(
self,
f: Optional[Callable] = ...,
role: Optional[Union[Tuple[str, str], Tuple[Tuple[str, str]], str]] = ...,
role: RoleType = ...,
optional: Optional[bool] = ...,
) -> Callable: ...
def username(self) -> str: ...
Expand Down Expand Up @@ -131,5 +134,7 @@ class MultiAuth:
self.additional_auth = args
def current_user(self) -> Optional[str]: ...
def login_required(
self, f: Optional[Callable] = ..., role: Optional[str] = ...
self,
f: Optional[Callable] = ...,
role: RoleType = ...,
) -> Callable: ...