Skip to content

Commit d111ff1

Browse files
committed
[Authlib] Update to 1.5.2
Closes: python#13834
1 parent 8e8254e commit d111ff1

File tree

6 files changed

+52
-12
lines changed

6 files changed

+52
-12
lines changed

stubs/Authlib/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "1.5.0"
1+
version = "~= 1.5.2"
22
upstream_repository = "https://github.com/lepture/authlib"
33
requires = ["cryptography"]
44
partial_stub = true

stubs/Authlib/authlib/common/urls.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ def quote(s: str, safe: bytes = b"/") -> str: ...
1616
def unquote(s: str) -> str: ...
1717
def quote_url(s: str) -> str: ...
1818
def extract_params(raw: dict[str, str] | _ExplodedQueryString) -> _ExplodedQueryString: ...
19-
def is_valid_url(url: str) -> bool: ...
19+
def is_valid_url(url: str, fragments_allowed: bool = True) -> bool: ...

stubs/Authlib/authlib/integrations/base_client/async_openid.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ __all__ = ["AsyncOpenIDMixin"]
55
class AsyncOpenIDMixin:
66
async def fetch_jwk_set(self, force: bool = False): ...
77
async def userinfo(self, **kwargs): ...
8-
async def parse_id_token(self, token, nonce, claims_options: Incomplete | None = None): ...
8+
async def parse_id_token(
9+
self, token, nonce, claims_options: Incomplete | None = None, claims_cls: Incomplete | None = None, leeway: int = 120
10+
): ...

stubs/Authlib/authlib/integrations/base_client/sync_openid.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ from _typeshed import Incomplete
33
class OpenIDMixin:
44
def fetch_jwk_set(self, force: bool = False): ...
55
def userinfo(self, **kwargs): ...
6-
def parse_id_token(self, token, nonce, claims_options: Incomplete | None = None, leeway: int = 120): ...
6+
def parse_id_token(
7+
self, token, nonce, claims_options: Incomplete | None = None, claims_cls: Incomplete | None = None, leeway: int = 120
8+
): ...
79
def create_load_key(self): ...
Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,55 @@
11
from _typeshed import Incomplete
2+
from collections.abc import Callable
3+
from re import Pattern
4+
from typing import Any, Final, Generic, TypedDict, TypeVar, overload, type_check_only
5+
from typing_extensions import TypeAlias
6+
7+
from ..rfc7517 import KeySet
8+
from .claims import JWTClaims
9+
10+
_T = TypeVar("_T")
11+
12+
_LoadKey: TypeAlias = Callable[[Incomplete, Incomplete], Incomplete]
213

314
class JsonWebToken:
4-
SENSITIVE_NAMES: Incomplete
5-
SENSITIVE_VALUES: Incomplete
15+
SENSITIVE_NAMES: Final[tuple[str, ...]]
16+
SENSITIVE_VALUES: Final[Pattern[str]]
17+
618
def __init__(self, algorithms, private_headers: Incomplete | None = None) -> None: ...
719
def check_sensitive_data(self, payload) -> None: ...
820
def encode(self, header, payload, key, check: bool = True): ...
21+
@overload
922
def decode(
1023
self,
11-
s,
12-
key,
13-
claims_cls: Incomplete | None = None,
24+
s: str | bytes,
25+
key: _LoadKey | KeySet | tuple[Incomplete, ...] | list[Incomplete] | str,
26+
claims_cls: None = None,
1427
claims_options: Incomplete | None = None,
1528
claims_params: Incomplete | None = None,
16-
): ...
29+
) -> JWTClaims: ...
30+
@overload
31+
def decode(
32+
self,
33+
s: str | bytes,
34+
key: _LoadKey | KeySet | tuple[Incomplete, ...] | list[Incomplete] | str,
35+
claims_cls: type[_T],
36+
claims_options: Incomplete | None = None,
37+
claims_params: Incomplete | None = None,
38+
) -> _T: ...
1739

1840
def decode_payload(bytes_payload): ...
19-
def prepare_raw_key(raw): ...
41+
42+
_TL = TypeVar("_TL", bound=tuple[Any, ...] | list[Any])
43+
44+
@type_check_only
45+
class _Keys(TypedDict, Generic[_TL]):
46+
keys: _TL
47+
48+
@overload
49+
def prepare_raw_key(raw: KeySet) -> KeySet: ...
50+
@overload
51+
def prepare_raw_key(raw: str) -> dict[str, Any] | str: ... # dict is a JSON object
52+
@overload
53+
def prepare_raw_key(raw: _TL) -> _Keys[_TL]: ...
2054
def find_encode_key(key, header): ...
21-
def create_load_key(key): ...
55+
def create_load_key(key: KeySet | _Keys[Incomplete] | Incomplete) -> _LoadKey: ...

stubs/Authlib/authlib/oauth2/base.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ from _typeshed import Incomplete
22

33
from authlib.common.errors import AuthlibHTTPError
44

5+
def invalid_error_characters(text: str) -> list[str]: ...
6+
57
class OAuth2Error(AuthlibHTTPError):
68
state: Incomplete
79
redirect_uri: Incomplete

0 commit comments

Comments
 (0)