Skip to content

Commit bd0f64a

Browse files
authored
[auth0-python] Add auth0-python stubs (#13716)
1 parent 2348836 commit bd0f64a

58 files changed

Lines changed: 1727 additions & 0 deletions

Some content is hidden

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

pyrightconfig.stricter.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"stdlib/tkinter/ttk.pyi",
2525
"stubs/aiofiles/aiofiles/tempfile/temptypes.pyi",
2626
"stubs/antlr4-python3-runtime",
27+
"stubs/auth0-python",
2728
"stubs/Authlib",
2829
"stubs/aws-xray-sdk",
2930
"stubs/beautifulsoup4",
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Omit tests
2+
auth0\.test.*
3+
4+
# Omit _async functions because they aren't present in the code
5+
auth0\..*_async
6+
7+
# Inconsistently implemented, ommitted
8+
auth0.asyncify.AsyncRestClient.file_post
9+
auth0.authentication.async_token_verifier.AsyncRestClient.file_post
10+
auth0.management.Auth0\..*
11+
auth0.rest_async.AsyncRestClient.file_post
12+
auth0.authentication.async_token_verifier.AsyncTokenVerifier.verify
13+
14+
# TYPE_CHECKING override makes these show up wrong
15+
auth0.management.async_auth0.RestClientOptions
16+
auth0.management.auth0.RestClientOptions
17+
auth0.rest.RequestsResponse

stubs/auth0-python/METADATA.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version = "4.8.*"
2+
upstream_repository = "https://github.com/auth0/auth0-python"
3+
requires = ["cryptography", "types-requests"]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from auth0.exceptions import (
2+
Auth0Error as Auth0Error,
3+
RateLimitError as RateLimitError,
4+
TokenValidationError as TokenValidationError,
5+
)
6+
7+
__all__ = ("Auth0Error", "RateLimitError", "TokenValidationError")
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from auth0.authentication import Users as Users
2+
from auth0.authentication.base import AuthenticationBase as AuthenticationBase
3+
from auth0.rest import RestClientOptions as RestClientOptions
4+
from auth0.rest_async import AsyncRestClient as AsyncRestClient
5+
6+
def asyncify(cls): ...
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from .database import Database as Database
2+
from .delegated import Delegated as Delegated
3+
from .enterprise import Enterprise as Enterprise
4+
from .get_token import GetToken as GetToken
5+
from .passwordless import Passwordless as Passwordless
6+
from .revoke_token import RevokeToken as RevokeToken
7+
from .social import Social as Social
8+
from .users import Users as Users
9+
10+
__all__ = ("Database", "Delegated", "Enterprise", "GetToken", "Passwordless", "RevokeToken", "Social", "Users")
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from _typeshed import Incomplete
2+
3+
from .. import TokenValidationError as TokenValidationError
4+
from ..rest_async import AsyncRestClient as AsyncRestClient
5+
from .token_verifier import (
6+
AsymmetricSignatureVerifier as AsymmetricSignatureVerifier,
7+
JwksFetcher as JwksFetcher,
8+
TokenVerifier as TokenVerifier,
9+
)
10+
11+
class AsyncAsymmetricSignatureVerifier(AsymmetricSignatureVerifier):
12+
def __init__(self, jwks_url: str, algorithm: str = "RS256") -> None: ...
13+
def set_session(self, session) -> None: ...
14+
15+
class AsyncJwksFetcher(JwksFetcher):
16+
def __init__(self, *args, **kwargs) -> None: ...
17+
def set_session(self, session) -> None: ...
18+
async def get_key(self, key_id: str): ...
19+
20+
class AsyncTokenVerifier(TokenVerifier):
21+
iss: Incomplete
22+
aud: Incomplete
23+
leeway: Incomplete
24+
def __init__(
25+
self, signature_verifier: AsyncAsymmetricSignatureVerifier, issuer: str, audience: str, leeway: int = 0
26+
) -> None: ...
27+
def set_session(self, session) -> None: ...
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from .base import AuthenticationBase as AuthenticationBase
2+
3+
class BackChannelLogin(AuthenticationBase):
4+
def back_channel_login(self, binding_message: str, login_hint: str, scope: str, **kwargs): ...
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from _typeshed import Incomplete
2+
3+
from auth0.rest import RestClient as RestClient, RestClientOptions as RestClientOptions
4+
from auth0.types import RequestData as RequestData
5+
6+
from .client_authentication import add_client_authentication as add_client_authentication
7+
8+
UNKNOWN_ERROR: str
9+
10+
class AuthenticationBase:
11+
domain: Incomplete
12+
client_id: Incomplete
13+
client_secret: Incomplete
14+
client_assertion_signing_key: Incomplete
15+
client_assertion_signing_alg: Incomplete
16+
protocol: Incomplete
17+
client: Incomplete
18+
def __init__(
19+
self,
20+
domain: str,
21+
client_id: str,
22+
client_secret: str | None = None,
23+
client_assertion_signing_key: str | None = None,
24+
client_assertion_signing_alg: str | None = None,
25+
telemetry: bool = True,
26+
timeout: float | tuple[float, float] = 5.0,
27+
protocol: str = "https",
28+
) -> None: ...
29+
def post(self, url: str, data: RequestData | None = None, headers: dict[str, str] | None = None): ...
30+
def authenticated_post(self, url: str, data: dict[str, Incomplete], headers: dict[str, str] | None = None): ...
31+
def get(self, url: str, params: dict[str, Incomplete] | None = None, headers: dict[str, str] | None = None): ...
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from _typeshed import Incomplete
2+
3+
def create_client_assertion_jwt(
4+
domain: str, client_id: str, client_assertion_signing_key: str, client_assertion_signing_alg: str | None
5+
) -> str: ...
6+
def add_client_authentication(
7+
payload: dict[str, Incomplete],
8+
domain: str,
9+
client_id: str,
10+
client_secret: str | None,
11+
client_assertion_signing_key: str | None,
12+
client_assertion_signing_alg: str | None,
13+
) -> dict[str, Incomplete]: ...

0 commit comments

Comments
 (0)