Skip to content

Bump oauthlib to 3.3.* #14300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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/oauthlib/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.2.*"
version = "3.3.*"
upstream_repository = "https://github.com/oauthlib/oauthlib"
partial_stub = true

Expand Down
5 changes: 5 additions & 0 deletions stubs/oauthlib/oauthlib/oauth2/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,8 @@ from .rfc6749.request_validator import RequestValidator as RequestValidator
from .rfc6749.tokens import BearerToken as BearerToken, OAuth2Token as OAuth2Token
from .rfc6749.utils import is_secure_transport as is_secure_transport
from .rfc8628.clients import DeviceClient as DeviceClient
from .rfc8628.endpoints import (
DeviceApplicationServer as DeviceApplicationServer,
DeviceAuthorizationEndpoint as DeviceAuthorizationEndpoint,
)
from .rfc8628.grant_types import DeviceCodeGrant as DeviceCodeGrant
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ from _typeshed import Unused
from collections.abc import Callable

from oauthlib.common import Request
from oauthlib.oauth2.rfc8628.grant_types import DeviceCodeGrant

from ..grant_types import (
AuthorizationCodeGrant,
Expand All @@ -24,6 +25,7 @@ class Server(AuthorizationEndpoint, IntrospectEndpoint, TokenEndpoint, ResourceE
password_grant: ResourceOwnerPasswordCredentialsGrant
credentials_grant: ClientCredentialsGrant
refresh_grant: RefreshTokenGrant
device_code_grant: DeviceCodeGrant
bearer: BearerToken
def __init__(
self,
Expand Down
1 change: 1 addition & 0 deletions stubs/oauthlib/oauthlib/oauth2/rfc6749/parameters.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ def parse_token_response(
body: str | bytes | bytearray, scope: str | set[object] | tuple[object] | list[object] | None = None
) -> OAuth2Token: ...
def validate_token_parameters(params: dict[str, Incomplete]) -> None: ...
def parse_expires(params: dict[str, Incomplete]) -> tuple[int | None, float | None, float | None]: ...
6 changes: 6 additions & 0 deletions stubs/oauthlib/oauthlib/oauth2/rfc8628/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
from logging import Logger

from .errors import (
AuthorizationPendingError as AuthorizationPendingError,
ExpiredTokenError as ExpiredTokenError,
SlowDownError as SlowDownError,
)

log: Logger
2 changes: 2 additions & 0 deletions stubs/oauthlib/oauthlib/oauth2/rfc8628/endpoints/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .device_authorization import DeviceAuthorizationEndpoint as DeviceAuthorizationEndpoint
from .pre_configured import DeviceApplicationServer as DeviceApplicationServer
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from collections.abc import Callable
from logging import Logger

from oauthlib.common import Request, _HTTPMethod
from oauthlib.oauth2.rfc6749.endpoints.base import BaseEndpoint
from oauthlib.openid.connect.core.request_validator import RequestValidator

log: Logger

class DeviceAuthorizationEndpoint(BaseEndpoint):
request_validator: RequestValidator
user_code_generator: Callable[[None], str] | None
def __init__(
self,
request_validator: RequestValidator,
verification_uri: str,
expires_in: int = 1800,
interval: int | None = None,
verification_uri_complete: str | None = None,
user_code_generator: Callable[[None], str] | None = None,
) -> None: ...
@property
def interval(self) -> int | None: ...
@property
def expires_in(self) -> int: ...
@property
def verification_uri(self) -> str: ...
def verification_uri_complete(self, user_code: str) -> str | None: ...
def validate_device_authorization_request(self, request: Request) -> None: ...
def create_device_authorization_response(
self, uri: str, http_method: _HTTPMethod = "POST", body: str | None = None, headers: dict[str, str] | None = None
) -> tuple[dict[str, str], dict[str, str | int], int]: ...
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from collections.abc import Callable

from oauthlib.openid.connect.core.request_validator import RequestValidator

from .device_authorization import DeviceAuthorizationEndpoint

class DeviceApplicationServer(DeviceAuthorizationEndpoint):
def __init__(
self,
request_validator: RequestValidator,
verification_uri: str,
interval: int = 5,
verification_uri_complete: str | None = None,
user_code_generator: Callable[[None], str] | None = None,
**kwargs,
) -> None: ...
13 changes: 13 additions & 0 deletions stubs/oauthlib/oauthlib/oauth2/rfc8628/errors.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from oauthlib.oauth2.rfc6749.errors import OAuth2Error

class AuthorizationPendingError(OAuth2Error):
error: str

class SlowDownError(OAuth2Error):
error: str

class ExpiredTokenError(OAuth2Error):
error: str

class AccessDenied(OAuth2Error):
error: str
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .device_code import DeviceCodeGrant as DeviceCodeGrant
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from oauthlib.common import Request
from oauthlib.oauth2.rfc6749.grant_types.base import GrantTypeBase
from oauthlib.oauth2.rfc6749.tokens import TokenBase

class DeviceCodeGrant(GrantTypeBase):
def create_authorization_response(self, request: Request, token_handler: TokenBase) -> tuple[dict[str, str], str, int]: ...
def validate_token_request(self, request: Request) -> None: ...
def create_token_response(self, request: Request, token_handler: TokenBase) -> tuple[dict[str, str], str, int]: ...
5 changes: 5 additions & 0 deletions stubs/oauthlib/oauthlib/oauth2/rfc8628/request_validator.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from oauthlib.common import Request
from oauthlib.oauth2 import RequestValidator as OAuth2RequestValidator

class RequestValidator(OAuth2RequestValidator):
def client_authentication_required(self, request: Request, *args, **kwargs) -> bool: ...
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ from oauthlib.oauth2.rfc6749.grant_types import (
)
from oauthlib.oauth2.rfc6749.request_validator import RequestValidator as OAuth2RequestValidator
from oauthlib.oauth2.rfc6749.tokens import BearerToken
from oauthlib.oauth2.rfc8628.grant_types import DeviceCodeGrant

from ..grant_types import AuthorizationCodeGrant, HybridGrant, ImplicitGrant
from ..grant_types.dispatchers import (
Expand All @@ -37,6 +38,7 @@ class Server(AuthorizationEndpoint, IntrospectEndpoint, TokenEndpoint, ResourceE
openid_connect_auth: AuthorizationCodeGrant
openid_connect_implicit: ImplicitGrant
openid_connect_hybrid: HybridGrant
device_code_grant: DeviceCodeGrant
bearer: BearerToken
jwt: JWTToken
auth_grant_choice: AuthorizationCodeGrantDispatcher
Expand Down