Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Remove v3 folder #462

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

Merged
merged 5 commits into from
Jan 19, 2023
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ bin/
*.egg
.pypirc
pyvenv.cfg
.python-version

# Installer logs
pip-log.txt
Expand Down
14 changes: 7 additions & 7 deletions EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ For symmetric algorithms like HS256, use the `SymmetricSignatureVerifier` class,
The following example demonstrates the verification of an ID token signed with the RS256 signing algorithm:

```python
from auth0.v3.authentication.token_verifier import TokenVerifier, AsymmetricSignatureVerifier
from auth0.authentication import TokenVerifier, AsymmetricSignatureVerifier

domain = 'myaccount.auth0.com'
client_id = 'exampleid'
Expand All @@ -53,7 +53,7 @@ If the token verification fails, a `TokenValidationError` will be raised. In tha
### Authenticating with a application configured to use `private_key_jwt` token endpoint auth method

```python
from auth0.v3.authentication import GetToken
from auth0.authentication import GetToken

private_key = """-----BEGIN RSA PRIVATE KEY-----
MIIJKQIBAAKCAgEAwfUb0nUC0aKB3WiytFhnCIg455BYC+dR3MUGadWpIg7S6lbi
Expand Down Expand Up @@ -152,22 +152,22 @@ Then additional methods with the `_async` suffix will be added to modules create
```python
import asyncio
import aiohttp
from auth0.v3.asyncify import asyncify
from auth0.v3.management import Auth0, Users, Connections
from auth0.v3.authentication import Users as AuthUsers
from auth0.asyncify import asyncify
from auth0.management import Auth0, Users, Connections
from auth0.authentication import Users as AuthUsers

auth0 = Auth0('domain', 'mgmt_api_token')


async def main():
# users = auth0.users.all() <= sync
users = await auth0.users.all_async() # <= async
users = await auth0.users.all_async() # <= async

# To share a session amongst multiple calls to the same service
async with auth0.users as users:
data = await users.get_async(id)
users.update_async(id, data)


# To share a session amongst multiple calls to multiple services
async with Auth0('domain', 'mgmt_api_token') as auth0:
user = await auth0.users.get_async(user_id)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The Authentication SDK is organized into components that mirror the structure of
For example:

```python
from auth0.v3.authentication import Social
from auth0.authentication import Social

social = Social('my-domain.us.auth0.com', 'my-client-id')

Expand All @@ -42,7 +42,7 @@ social.login(access_token='...', connection='facebook')
If you need to sign up a user using their email and password, you can use the Database object.

```python
from auth0.v3.authentication import Database
from auth0.authentication import Database

database = Database('my-domain.us.auth0.com', 'my-client-id')

Expand All @@ -52,7 +52,7 @@ database.signup(email='[email protected]', password='secr3t', connection='Username
If you need to authenticate a user using their email and password, you can use the `GetToken` object, which enables making requests to the `/oauth/token` endpoint.

```python
from auth0.v3.authentication import GetToken
from auth0.authentication import GetToken

token = GetToken('my-domain.us.auth0.com', 'my-client-id', client_secret='my-client-secret')

Expand All @@ -63,7 +63,7 @@ token.login(username='[email protected]', password='secr3t', realm='Username-Passw
To use the management library you will need to instantiate an Auth0 object with a domain and a [Management API v2 token](https://auth0.com/docs/api/management/v2/tokens). Please note that these token last 24 hours, so if you need it constantly you should ask for it programmatically using the client credentials grant with a [non interactive client](https://auth0.com/docs/api/management/v2/tokens#1-create-and-authorize-a-client) authorized to access the API. For example:

```python
from auth0.v3.authentication import GetToken
from auth0.authentication import GetToken

domain = 'myaccount.auth0.com'
non_interactive_client_id = 'exampleid'
Expand All @@ -77,7 +77,7 @@ mgmt_api_token = token['access_token']
Then use the token you've obtained as follows:

```python
from auth0.v3.management import Auth0
from auth0.management import Auth0

domain = 'myaccount.auth0.com'
mgmt_api_token = 'MGMT_API_TOKEN'
Expand Down
25 changes: 23 additions & 2 deletions V4_MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Guide to migrating from `3.x` to `4.x`

- [Python <3.7 is no longer supported](#python-37-is-no-longer-supported)
- [The `v3` subfolder has been removed](#the-v3-subfolder-has-been-removed)
- [Client ID and client secret are now specified in the constructor for authentication clients](#client-id-and-client-secret-are-now-specified-in-the-constructor-for-authentication-clients)
- [AuthorizeClient and Logout have been removed](#authorizeclient-and-logout-have-been-removed)
- [Methods that call deprecated endpoints have been removed](#methods-that-call-deprecated-endpoints-have-been-removed)
Expand All @@ -11,12 +12,32 @@ Guide to migrating from `3.x` to `4.x`

Python <=3.6 and Python 2 are EOL and are no longer supported.

## The `v3` subfolder has been removed

Versioning the import paths was not necessary and made major upgrades unnecessarily complex, so this has been removed and all files have been moved up a directory.

### Before

```python
from auth0.v3.management import Auth0

auth0 = Auth0(domain, mgmt_api_token)
```

### After

```python
from auth0.management import Auth0

auth0 = Auth0(domain, mgmt_api_token)
```

## Client ID and client secret are now specified in the constructor for authentication clients

### Before

```py
from auth0.v3.authentication import GetToken
from auth0.authentication import GetToken

get_token = GetToken('my-domain.us.auth0.com')

Expand All @@ -26,7 +47,7 @@ get_token.client_credentials('my-client-id', 'my-client-secret', 'my-api')
### After

```py
from auth0.v3.authentication import GetToken
from auth0.authentication import GetToken

# `client_secret` is optional (you can now use `client_assertion_signing_key` as an alternative)
get_token = GetToken('my-domain.us.auth0.com', 'my-client-id', client_secret='my-client-secret')
Expand Down
4 changes: 4 additions & 0 deletions auth0/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
__version__ = "3.24.0"

from auth0.exceptions import Auth0Error, RateLimitError, TokenValidationError

__all__ = ("Auth0Error", "RateLimitError", "TokenValidationError")
2 changes: 1 addition & 1 deletion auth0/v3/asyncify.py → auth0/asyncify.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import aiohttp

from auth0.v3.rest_async import AsyncRestClient
from auth0.rest_async import AsyncRestClient


def _gen_async(client, method):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import base64
import json
import platform
import sys
from auth0.rest import RestClient, RestClientOptions

import requests

from auth0.v3.rest import RestClient, RestClientOptions

from ..exceptions import Auth0Error, RateLimitError
from .client_authentication import add_client_authentication

UNKNOWN_ERROR = "a0.sdk.internal.unknown"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import jwt
import requests

from auth0.v3.exceptions import TokenValidationError
from auth0.exceptions import TokenValidationError


class SignatureVerifier(object):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import warnings

from auth0.v3.rest import RestClient, RestClientOptions
from auth0.rest import RestClient, RestClientOptions


class Users(object):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion auth0/v3/rest.py → auth0/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import requests

from auth0.v3.exceptions import Auth0Error, RateLimitError
from auth0.exceptions import Auth0Error, RateLimitError

UNKNOWN_ERROR = "a0.sdk.internal.unknown"

Expand Down
2 changes: 1 addition & 1 deletion auth0/v3/rest_async.py → auth0/rest_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import aiohttp

from auth0.v3.exceptions import RateLimitError
from auth0.exceptions import RateLimitError

from .rest import EmptyResponse, JsonResponse, PlainResponse, RestClient

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


class TestDatabase(unittest.TestCase):
@mock.patch("auth0.v3.rest.RestClient.post")
@mock.patch("auth0.rest.RestClient.post")
def test_signup(self, mock_post):
d = Database("my.domain.com", "cid")

Expand Down Expand Up @@ -61,7 +61,7 @@ def test_signup(self, mock_post):
},
)

@mock.patch("auth0.v3.rest.RestClient.post")
@mock.patch("auth0.rest.RestClient.post")
def test_change_password(self, mock_post):
d = Database("my.domain.com", "cid")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


class TestDelegated(unittest.TestCase):
@mock.patch("auth0.v3.authentication.delegated.Delegated.post")
@mock.patch("auth0.authentication.delegated.Delegated.post")
def test_get_token_id_token(self, mock_post):

d = Delegated("my.domain.com", "cid")
Expand Down Expand Up @@ -34,7 +34,7 @@ def test_get_token_id_token(self, mock_post):
},
)

@mock.patch("auth0.v3.authentication.delegated.Delegated.post")
@mock.patch("auth0.authentication.delegated.Delegated.post")
def test_get_token_refresh_token(self, mock_post):

d = Delegated("my.domain.com", "cid")
Expand All @@ -61,7 +61,7 @@ def test_get_token_refresh_token(self, mock_post):
},
)

@mock.patch("auth0.v3.authentication.delegated.Delegated.post")
@mock.patch("auth0.authentication.delegated.Delegated.post")
def test_get_token_value_error(self, mock_post):

d = Delegated("my.domain.com", "cid")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


class TestEnterprise(unittest.TestCase):
@mock.patch("auth0.v3.authentication.enterprise.Enterprise.get")
@mock.patch("auth0.authentication.enterprise.Enterprise.get")
def test_saml_metadata(self, mock_get):

e = Enterprise("my.domain.com", "cid")
Expand All @@ -15,7 +15,7 @@ def test_saml_metadata(self, mock_get):

mock_get.assert_called_with(url="https://my.domain.com/samlp/metadata/cid")

@mock.patch("auth0.v3.authentication.enterprise.Enterprise.get")
@mock.patch("auth0.authentication.enterprise.Enterprise.get")
def test_wsfed_metadata(self, mock_get):

e = Enterprise("my.domain.com", "cid")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def get_private_key():


class TestGetToken(unittest.TestCase):
@mock.patch("auth0.v3.rest.RestClient.post")
@mock.patch("auth0.rest.RestClient.post")
def test_authorization_code(self, mock_post):

g = GetToken("my.domain.com", "cid", client_secret="clsec")
Expand All @@ -45,7 +45,7 @@ def test_authorization_code(self, mock_post):
},
)

@mock.patch("auth0.v3.rest.RestClient.post")
@mock.patch("auth0.rest.RestClient.post")
def test_authorization_code_with_client_assertion(self, mock_post):

g = GetToken(
Expand All @@ -69,7 +69,7 @@ def test_authorization_code_with_client_assertion(self, mock_post):
},
)

@mock.patch("auth0.v3.rest.RestClient.post")
@mock.patch("auth0.rest.RestClient.post")
def test_authorization_code_pkce(self, mock_post):

g = GetToken("my.domain.com", "cid")
Expand All @@ -95,7 +95,7 @@ def test_authorization_code_pkce(self, mock_post):
},
)

@mock.patch("auth0.v3.rest.RestClient.post")
@mock.patch("auth0.rest.RestClient.post")
def test_client_credentials(self, mock_post):

g = GetToken("my.domain.com", "cid", client_secret="clsec")
Expand All @@ -115,7 +115,7 @@ def test_client_credentials(self, mock_post):
},
)

@mock.patch("auth0.v3.rest.RestClient.post")
@mock.patch("auth0.rest.RestClient.post")
def test_client_credentials_with_client_assertion(self, mock_post):
g = GetToken(
"my.domain.com", "cid", client_assertion_signing_key=get_private_key()
Expand All @@ -137,7 +137,7 @@ def test_client_credentials_with_client_assertion(self, mock_post):
},
)

@mock.patch("auth0.v3.rest.RestClient.post")
@mock.patch("auth0.rest.RestClient.post")
def test_login(self, mock_post):

g = GetToken("my.domain.com", "cid", client_secret="clsec")
Expand Down Expand Up @@ -168,7 +168,7 @@ def test_login(self, mock_post):
},
)

@mock.patch("auth0.v3.rest.RestClient.post")
@mock.patch("auth0.rest.RestClient.post")
def test_refresh_token(self, mock_post):
g = GetToken("my.domain.com", "cid", client_secret="clsec")

Expand All @@ -192,7 +192,7 @@ def test_refresh_token(self, mock_post):
},
)

@mock.patch("auth0.v3.rest.RestClient.post")
@mock.patch("auth0.rest.RestClient.post")
def test_passwordless_login_with_sms(self, mock_post):

g = GetToken("my.domain.com", "cid", client_secret="csec")
Expand Down Expand Up @@ -222,7 +222,7 @@ def test_passwordless_login_with_sms(self, mock_post):
},
)

@mock.patch("auth0.v3.rest.RestClient.post")
@mock.patch("auth0.rest.RestClient.post")
def test_passwordless_login_with_email(self, mock_post):
g = GetToken("my.domain.com", "cid", client_secret="csec")

Expand Down
Loading