Skip to content

Commit 61f1e83

Browse files
committed
[Authlib] Update to 1.7.1
Closes: #15649 Diff: authlib/authlib@v1.6.11...v1.7.1
1 parent a48daed commit 61f1e83

41 files changed

Lines changed: 309 additions & 90 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

stubs/Authlib/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
version = "1.6.11"
1+
version = "1.7.1"
22
upstream-repository = "https://github.com/authlib/authlib"
33
dependencies = ["cryptography"]
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
class AuthlibDeprecationWarning(DeprecationWarning): ...
22

3-
def deprecate(
4-
message: str, version: str | None = None, link_uid: str | None = None, link_file: str | None = None, stacklevel: int = 3
5-
) -> None: ...
3+
def deprecate(message: str, version: str | None = None, stacklevel: int = 3) -> None: ...

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from authlib.integrations.base_client.sync_openid import _LogoutData
12
from authlib.oidc.core.claims import UserInfo
23

34
__all__ = ["AsyncOpenIDMixin"]
@@ -6,3 +7,6 @@ class AsyncOpenIDMixin:
67
async def fetch_jwk_set(self, force: bool = False): ...
78
async def userinfo(self, **kwargs) -> UserInfo: ...
89
async def parse_id_token(self, token, nonce, claims_options=None, claims_cls=None, leeway: int = 120) -> UserInfo: ...
10+
async def create_logout_url(
11+
self, post_logout_redirect_uri=None, id_token_hint=None, state=None, *, client_id=None, logout_hint=None, ui_locales=None
12+
) -> _LogoutData: ...
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1+
from _typeshed import Incomplete
2+
from typing import TypedDict, type_check_only
3+
14
from authlib.oidc.core.claims import UserInfo
25

6+
@type_check_only
7+
class _LogoutData(TypedDict):
8+
url: str
9+
state: Incomplete
10+
311
class OpenIDMixin:
412
def fetch_jwk_set(self, force: bool = False): ...
513
def userinfo(self, **kwargs) -> UserInfo: ...
614
def parse_id_token(self, token, nonce, claims_options=None, claims_cls=None, leeway: int = 120) -> UserInfo | None: ...
7-
def create_load_key(self): ...
15+
def create_logout_url(
16+
self, post_logout_redirect_uri=None, id_token_hint=None, state=None, *, client_id=None, logout_hint=None, ui_locales=None
17+
) -> _LogoutData: ...

stubs/Authlib/authlib/integrations/django_client/apps.pyi

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
from _typeshed import Incomplete
2+
from typing import TypeAlias
3+
14
from ..base_client import BaseApp, OAuth1Mixin, OAuth2Mixin, OpenIDMixin
25
from ..requests_client import OAuth1Session, OAuth2Session
36

7+
_HttpResponseRedirect: TypeAlias = Incomplete # actual type is django.http.response.HttpResponseRedirect
8+
49
class DjangoAppMixin:
510
def save_authorize_data(self, request, **kwargs) -> None: ...
611
def authorize_redirect(self, request, redirect_uri=None, **kwargs): ...
@@ -11,4 +16,16 @@ class DjangoOAuth1App(DjangoAppMixin, OAuth1Mixin, BaseApp):
1116

1217
class DjangoOAuth2App(DjangoAppMixin, OAuth2Mixin, OpenIDMixin, BaseApp):
1318
client_cls = OAuth2Session
19+
def logout_redirect(
20+
self,
21+
request,
22+
post_logout_redirect_uri=None,
23+
id_token_hint=None,
24+
*,
25+
state=None,
26+
client_id=None,
27+
logout_hint=None,
28+
ui_locales=None,
29+
) -> _HttpResponseRedirect: ...
30+
def validate_logout_response(self, request): ...
1431
def authorize_access_token(self, request, **kwargs): ...

stubs/Authlib/authlib/integrations/flask_client/apps.pyi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
from _typeshed import Incomplete
2+
from typing import TypeAlias
3+
14
from ..base_client import BaseApp, OAuth1Mixin, OAuth2Mixin, OpenIDMixin
25
from ..requests_client import OAuth1Session, OAuth2Session
36

7+
_Response: TypeAlias = Incomplete # actual type is werkzeug.wrappers.Response
8+
49
class FlaskAppMixin:
510
@property
611
def token(self): ...
@@ -15,4 +20,8 @@ class FlaskOAuth1App(FlaskAppMixin, OAuth1Mixin, BaseApp):
1520

1621
class FlaskOAuth2App(FlaskAppMixin, OAuth2Mixin, OpenIDMixin, BaseApp):
1722
client_cls = OAuth2Session
23+
def logout_redirect(
24+
self, post_logout_redirect_uri=None, id_token_hint=None, *, state=None, client_id=None, logout_hint=None, ui_locales=None
25+
) -> _Response: ...
26+
def validate_logout_response(self): ...
1827
def authorize_access_token(self, **kwargs): ...
Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,33 @@
1+
from _typeshed import Incomplete
2+
from typing import TypeAlias
3+
14
from ..base_client import BaseApp
25
from ..base_client.async_app import AsyncOAuth1Mixin, AsyncOAuth2Mixin
36
from ..base_client.async_openid import AsyncOpenIDMixin
47
from ..httpx_client import AsyncOAuth1Client, AsyncOAuth2Client
58

9+
_RedirectResponse: TypeAlias = Incomplete # actual type is starlette.responses.RedirectResponse
10+
611
class StarletteAppMixin:
712
async def save_authorize_data(self, request, **kwargs) -> None: ...
8-
async def authorize_redirect(self, request, redirect_uri=None, **kwargs): ...
13+
async def authorize_redirect(self, request, redirect_uri=None, **kwargs) -> _RedirectResponse: ...
914

1015
class StarletteOAuth1App(StarletteAppMixin, AsyncOAuth1Mixin, BaseApp):
1116
client_cls = AsyncOAuth1Client
1217
async def authorize_access_token(self, request, **kwargs): ...
1318

1419
class StarletteOAuth2App(StarletteAppMixin, AsyncOAuth2Mixin, AsyncOpenIDMixin, BaseApp):
1520
client_cls = AsyncOAuth2Client
21+
async def logout_redirect(
22+
self,
23+
request,
24+
post_logout_redirect_uri=None,
25+
id_token_hint=None,
26+
*,
27+
state=None,
28+
client_id=None,
29+
logout_hint=None,
30+
ui_locales=None,
31+
) -> _RedirectResponse: ...
32+
async def validate_logout_response(self, request): ...
1633
async def authorize_access_token(self, request, **kwargs): ...

stubs/Authlib/authlib/jose/rfc7519/claims.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ class BaseClaims(dict[str, Any]): # dict values are key-dependent
1212
def get_registered_claims(self) -> dict[str, Incomplete]: ...
1313

1414
class JWTClaims(BaseClaims):
15-
def validate(self, now=None, leeway: int = 0) -> None: ...
15+
def validate(self, now: int | None = None, leeway: int = 0) -> None: ...
1616
def validate_iss(self) -> None: ...
1717
def validate_sub(self) -> None: ...
1818
def validate_aud(self) -> None: ...
19-
def validate_exp(self, now, leeway) -> None: ...
20-
def validate_nbf(self, now, leeway) -> None: ...
21-
def validate_iat(self, now, leeway) -> None: ...
19+
def validate_exp(self, now: int, leeway: int) -> None: ...
20+
def validate_nbf(self, now: int, leeway: int) -> None: ...
21+
def validate_iat(self, now: int, leeway: int) -> None: ...
2222
def validate_jti(self) -> None: ...
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from _typeshed import Incomplete
2+
from collections.abc import Callable
3+
from typing import Any, TypedDict
4+
5+
class ClaimsOption(TypedDict, total=False):
6+
essential: bool
7+
allow_blank: bool | None
8+
value: str | int | bool
9+
values: list[str | int | bool] | list[str] | list[int] | list[bool]
10+
validate: Callable[[BaseClaims, Any], bool]
11+
12+
class BaseClaims(dict[str, Incomplete]):
13+
registry_cls: Incomplete
14+
REGISTERED_CLAIMS: list[str]
15+
header: dict[str, Any]
16+
options: dict[str, ClaimsOption]
17+
params: dict[str, Any]
18+
def __init__(
19+
self,
20+
claims: dict[str, Any],
21+
header: dict[str, Any],
22+
options: dict[str, ClaimsOption] | None = None,
23+
params: dict[str, Any] | None = None,
24+
) -> None: ...
25+
def get_registered_claims(self) -> dict[str, Incomplete]: ...
26+
def validate(self, now: int | Callable[[], int] | None = None, leeway: int = 0) -> None: ...
27+
28+
class JWTClaims(BaseClaims):
29+
registry_cls: Incomplete
30+
REGISTERED_CLAIMS: list[str]
31+
def validate(self, now: int | Callable[[], int] | None = None, leeway: int = 0) -> None: ...

stubs/Authlib/authlib/oauth2/rfc6749/__init__.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from .authenticate_client import ClientAuthentication as ClientAuthentication
22
from .authorization_server import AuthorizationServer as AuthorizationServer
3+
from .endpoint import Endpoint, EndpointRequest
34
from .errors import (
45
AccessDeniedError as AccessDeniedError,
56
InsecureTransportError as InsecureTransportError,
@@ -69,6 +70,8 @@ __all__ = [
6970
"AuthorizationServer",
7071
"ResourceProtector",
7172
"TokenValidator",
73+
"Endpoint",
74+
"EndpointRequest",
7275
"TokenEndpoint",
7376
"BaseGrant",
7477
"AuthorizationEndpointMixin",

0 commit comments

Comments
 (0)