Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion stubs/Authlib/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "1.7.2"
version = "1.8.0"
upstream-repository = "https://github.com/authlib/authlib"
dependencies = ["cryptography"]
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
from _typeshed import Incomplete
from typing import TypeAlias

from authlib.oauth2.rfc7521 import AssertionClient as _AssertionClient

from ..base_client import OAuthError
from .oauth2_client import OAuth2Auth

USE_CLIENT_DEFAULT = Incomplete # actual httpx2.USE_CLIENT_DEFAULT
Response: TypeAlias = Incomplete # actual httpx2.Response

__all__ = ["AsyncAssertionClient"]

# Inherits from httpx.AsyncClient
# Inherits from httpx2.AsyncClient
class AsyncAssertionClient(_AssertionClient):
token_auth_class = OAuth2Auth
oauth_error_class = OAuthError # type: ignore[assignment]
Expand All @@ -24,11 +28,12 @@ class AsyncAssertionClient(_AssertionClient):
claims=None,
token_placement="header",
scope=None,
client_id=None,
**kwargs,
) -> None: ...
async def request(self, method, url, withhold_token=False, auth=..., **kwargs): ...

# Inherits from httpx.Client
# Inherits from httpx2.Client
class AssertionClient(_AssertionClient):
token_auth_class = OAuth2Auth
oauth_error_class = OAuthError # type: ignore[assignment]
Expand All @@ -45,6 +50,7 @@ class AssertionClient(_AssertionClient):
claims=None,
token_placement="header",
scope=None,
client_id=None,
**kwargs,
) -> None: ...
def request(self, method, url, withhold_token=False, auth=..., **kwargs): ...
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ from typing_extensions import Never
from authlib.oauth1 import ClientAuth
from authlib.oauth1.client import OAuth1Client as _OAuth1Client

_Response: TypeAlias = Incomplete # actual type is httpx.Response
_Request: TypeAlias = Incomplete # actual type is httpx.Request
Auth: TypeAlias = Incomplete # actual type is httpx2.Auth
Request: TypeAlias = Incomplete # actual type is httpx2.Request
Response: TypeAlias = Incomplete # actual type is httpx2.Response

# Inherits from httpx.Auth
# Inherits from httpx2.Auth
class OAuth1Auth(ClientAuth):
requires_request_body: bool
def auth_flow(self, request: _Request) -> Generator[_Request, _Response]: ...
def auth_flow(self, request: Request) -> Generator[Request, Response]: ...

# Inherits from httpx.AsyncClient
# Inherits from httpx2.AsyncClient
class AsyncOAuth1Client(_OAuth1Client):
auth_class = OAuth1Auth
def __init__(
Expand All @@ -35,7 +36,7 @@ class AsyncOAuth1Client(_OAuth1Client):
@staticmethod
def handle_error(error_type: str | None, error_description: str | None) -> Never: ...

# Inherits from httpx.Client
# Inherits from httpx2.Client
class OAuth1Client(_OAuth1Client):
auth_class = OAuth1Auth
def __init__(
Expand Down
20 changes: 11 additions & 9 deletions stubs/Authlib/authlib/integrations/httpx_client/oauth2_client.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,24 @@ from authlib.oauth2.client import OAuth2Client as _OAuth2Client

from ..base_client import OAuthError

__all__ = ["OAuth2Auth", "OAuth2ClientAuth", "AsyncOAuth2Client", "OAuth2Client"]
USE_CLIENT_DEFAULT = Incomplete # actual httpx2.USE_CLIENT_DEFAULT
Auth = Incomplete # actual type is httpx2.Auth
Request: TypeAlias = Incomplete # actual type is httpx2.Request
Response: TypeAlias = Incomplete # actual type is httpx2.Response

_Response: TypeAlias = Incomplete # actual type is httpx.Response
_Request: TypeAlias = Incomplete # actual type is httpx.Request
__all__ = ["OAuth2Auth", "OAuth2ClientAuth", "AsyncOAuth2Client", "OAuth2Client"]

# Inherits from httpx.Auth
# Inherits from httpx2.Auth
class OAuth2Auth(TokenAuth):
requires_request_body: bool
def auth_flow(self, request: _Request) -> Generator[_Request, _Response]: ...
def auth_flow(self, request: Request) -> Generator[Request, Response]: ...

# Inherits from httpx.Auth
# Inherits from httpx2.Auth
class OAuth2ClientAuth(ClientAuth):
requires_request_body: bool
def auth_flow(self, request: _Request) -> Generator[_Request, _Response]: ...
def auth_flow(self, request: Request) -> Generator[Request, Response]: ...

# Inherits from httpx.AsyncClient
# Inherits from httpx2.AsyncClient
class AsyncOAuth2Client(_OAuth2Client):
SESSION_REQUEST_PARAMS: list[str]
client_auth_class = OAuth2ClientAuth
Expand All @@ -47,7 +49,7 @@ class AsyncOAuth2Client(_OAuth2Client):
async def stream(self, method, url, withhold_token: bool = False, auth=..., **kwargs) -> Generator[Incomplete]: ...
async def ensure_active_token(self, token): ... # type: ignore[override]

# Inherits from httpx.Client
# Inherits from httpx2.Client
class OAuth2Client(_OAuth2Client):
SESSION_REQUEST_PARAMS: list[str]
client_auth_class = OAuth2ClientAuth
Expand Down
14 changes: 6 additions & 8 deletions stubs/Authlib/authlib/integrations/httpx_client/utils.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ from typing import Final, TypeAlias

HTTPX_CLIENT_KWARGS: Final[list[str]]

_Request: TypeAlias = Incomplete # actual type is httpx.Request
_URL: TypeAlias = Incomplete # actual type is httpx.URL
_Headers: TypeAlias = MutableMapping[str, str] # actual type is httpx.Headers
_HeaderTypes: TypeAlias = ( # actual type is httpx._types.HeaderTypes
Request: TypeAlias = Incomplete # actual type is httpx2.Request
_URL: TypeAlias = Incomplete # actual type is httpx2.URL
_Headers: TypeAlias = MutableMapping[str, str] # actual type is httpx2.Headers
_HeaderTypes: TypeAlias = ( # actual type is httpx2._types.HeaderTypes
_Headers | Mapping[str, str] | Mapping[bytes, bytes] | Sequence[tuple[str, str]] | Sequence[tuple[bytes, bytes]]
)
_RequestContent: TypeAlias = str | bytes | Iterable[bytes] | AsyncIterable[bytes] # actual type is httpx._types.RequestContent
_RequestContent: TypeAlias = str | bytes | Iterable[bytes] | AsyncIterable[bytes] # actual type is httpx2._types.RequestContent

def extract_client_kwargs(kwargs: dict[str, Incomplete]) -> dict[str, Incomplete]: ...
def build_request(
url: _URL | str, headers: _HeaderTypes | None, body: _RequestContent, initial_request: _Request
) -> _Request: ...
def build_request(url: _URL | str, headers: _HeaderTypes | None, body: _RequestContent, initial_request: Request) -> Request: ...
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class AssertionSession(AssertionClient):
claims=None,
token_placement="header",
scope=None,
client_id=None,
default_timeout=None,
leeway=60,
**kwargs,
Expand Down
2 changes: 2 additions & 0 deletions stubs/Authlib/authlib/oauth2/rfc7521/client.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class AssertionClient:
audience: Incomplete
claims: Incomplete
scope: Incomplete
client_id: Incomplete
token_auth: Incomplete
leeway: Incomplete
def __init__(
Expand All @@ -28,6 +29,7 @@ class AssertionClient:
claims=None,
token_placement: str = "header",
scope=None,
client_id=None,
leeway: int = 60,
**kwargs,
) -> None: ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/Authlib/authlib/oauth2/rfc7523/jwt_bearer.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class JWTBearerGrant(BaseGrant, TokenEndpointMixin):
def sign(key, issuer, audience, subject=None, issued_at=None, expires_at=None, claims=None, **kwargs): ...
def verify_claims(self, claims: dict[str, Incomplete]) -> None: ...
def process_assertion_claims(self, assertion) -> dict[str, Incomplete]: ...
def extract_assertion(self, assertion: str) -> tuple[dict[str, Incomplete], Incomplete]: ...
def extract_assertion(self, assertion: str) -> tuple[dict[str, Incomplete], dict[Incomplete, Incomplete]]: ...
def validate_token_request(self) -> None: ...
def create_token_response(self): ...
def resolve_issuer_client(self, issuer): ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/Authlib/authlib/oauth2/rfc7523/token.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class JWTBearerTokenGenerator:
@staticmethod
def get_allowed_scope(client, scope): ...
@staticmethod
def get_sub_value(user): ...
def get_sub_value(user) -> str: ...
def get_token_data(self, grant_type, client, expires_in, user=None, scope=None): ...
def generate(self, grant_type, client, user=None, scope=None, expires_in=None): ...
def __call__(self, grant_type, client, user=None, scope=None, expires_in=None, include_refresh_token: bool = True): ...
3 changes: 2 additions & 1 deletion stubs/Authlib/authlib/oauth2/rfc7523/validator.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ class JWTBearerTokenValidator(BearerTokenValidator):
token_cls = JWTBearerToken
public_key: Incomplete
claims_options: Incomplete
def __init__(self, public_key, issuer=None, realm=None, **extra_attributes) -> None: ...
leeway: int
def __init__(self, public_key, issuer=None, realm=None, leeway: int = 60, **extra_attributes) -> None: ...
def authenticate_token(self, token_string: str) -> JWTBearerToken | None: ...