auth0-python 4.8.1__tar.gz → 4.9.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. {auth0_python-4.8.1 → auth0_python-4.9.0}/PKG-INFO +1 -1
  2. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/__init__.py +1 -1
  3. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/authentication/back_channel_login.py +1 -0
  4. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/authentication/get_token.py +35 -0
  5. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/users.py +44 -1
  6. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/authentication/test_back_channel_login.py +60 -0
  7. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/authentication/test_get_token.py +30 -0
  8. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/authentication/test_pushed_authorization_requests.py +1 -1
  9. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_users.py +33 -0
  10. {auth0_python-4.8.1 → auth0_python-4.9.0}/pyproject.toml +1 -1
  11. {auth0_python-4.8.1 → auth0_python-4.9.0}/LICENSE +0 -0
  12. {auth0_python-4.8.1 → auth0_python-4.9.0}/README.md +0 -0
  13. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/asyncify.py +0 -0
  14. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/authentication/__init__.py +0 -0
  15. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/authentication/async_token_verifier.py +0 -0
  16. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/authentication/base.py +0 -0
  17. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/authentication/client_authentication.py +0 -0
  18. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/authentication/database.py +0 -0
  19. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/authentication/delegated.py +0 -0
  20. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/authentication/enterprise.py +0 -0
  21. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/authentication/passwordless.py +0 -0
  22. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/authentication/pushed_authorization_requests.py +0 -0
  23. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/authentication/revoke_token.py +0 -0
  24. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/authentication/social.py +0 -0
  25. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/authentication/token_verifier.py +0 -0
  26. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/authentication/users.py +0 -0
  27. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/exceptions.py +0 -0
  28. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/__init__.py +0 -0
  29. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/actions.py +0 -0
  30. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/async_auth0.py +0 -0
  31. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/attack_protection.py +0 -0
  32. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/auth0.py +0 -0
  33. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/blacklists.py +0 -0
  34. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/branding.py +0 -0
  35. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/client_credentials.py +0 -0
  36. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/client_grants.py +0 -0
  37. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/clients.py +0 -0
  38. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/connections.py +0 -0
  39. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/custom_domains.py +0 -0
  40. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/device_credentials.py +0 -0
  41. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/email_templates.py +0 -0
  42. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/emails.py +0 -0
  43. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/grants.py +0 -0
  44. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/guardian.py +0 -0
  45. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/hooks.py +0 -0
  46. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/jobs.py +0 -0
  47. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/log_streams.py +0 -0
  48. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/logs.py +0 -0
  49. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/organizations.py +0 -0
  50. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/prompts.py +0 -0
  51. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/resource_servers.py +0 -0
  52. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/roles.py +0 -0
  53. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/rules.py +0 -0
  54. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/rules_configs.py +0 -0
  55. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/stats.py +0 -0
  56. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/tenants.py +0 -0
  57. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/tickets.py +0 -0
  58. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/user_blocks.py +0 -0
  59. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/management/users_by_email.py +0 -0
  60. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/rest.py +0 -0
  61. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/rest_async.py +0 -0
  62. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/__init__.py +0 -0
  63. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/authentication/__init__.py +0 -0
  64. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/authentication/test_base.py +0 -0
  65. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/authentication/test_database.py +0 -0
  66. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/authentication/test_delegated.py +0 -0
  67. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/authentication/test_enterprise.py +0 -0
  68. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/authentication/test_passwordless.py +0 -0
  69. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/authentication/test_revoke_token.py +0 -0
  70. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/authentication/test_social.py +0 -0
  71. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/authentication/test_token_verifier.py +0 -0
  72. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/authentication/test_users.py +0 -0
  73. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/__init__.py +0 -0
  74. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_actions.py +0 -0
  75. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_atack_protection.py +0 -0
  76. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_auth0.py +0 -0
  77. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_blacklists.py +0 -0
  78. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_branding.py +0 -0
  79. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_client_credentials.py +0 -0
  80. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_client_grants.py +0 -0
  81. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_clients.py +0 -0
  82. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_connections.py +0 -0
  83. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_custom_domains.py +0 -0
  84. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_device_credentials.py +0 -0
  85. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_email_endpoints.py +0 -0
  86. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_emails.py +0 -0
  87. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_grants.py +0 -0
  88. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_guardian.py +0 -0
  89. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_hooks.py +0 -0
  90. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_jobs.py +0 -0
  91. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_log_streams.py +0 -0
  92. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_logs.py +0 -0
  93. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_organizations.py +0 -0
  94. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_prompts.py +0 -0
  95. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_resource_servers.py +0 -0
  96. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_rest.py +0 -0
  97. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_roles.py +0 -0
  98. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_rules.py +0 -0
  99. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_rules_configs.py +0 -0
  100. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_stats.py +0 -0
  101. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_tenants.py +0 -0
  102. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_tickets.py +0 -0
  103. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_user_blocks.py +0 -0
  104. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test/management/test_users_by_email.py +0 -0
  105. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test_async/__init__.py +0 -0
  106. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test_async/test_async_auth0.py +0 -0
  107. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test_async/test_async_token_verifier.py +0 -0
  108. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/test_async/test_asyncify.py +0 -0
  109. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/types.py +0 -0
  110. {auth0_python-4.8.1 → auth0_python-4.9.0}/auth0/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: auth0-python
3
- Version: 4.8.1
3
+ Version: 4.9.0
4
4
  Summary:
5
5
  Home-page: https://auth0.com
6
6
  License: MIT
@@ -1,5 +1,5 @@
1
1
  # This value is updated by `poetry_dynamic_versioning` during build time from the latest git tag
2
- __version__ = "4.8.1"
2
+ __version__ = "4.9.0"
3
3
 
4
4
  from auth0.exceptions import Auth0Error, RateLimitError, TokenValidationError
5
5
 
@@ -34,4 +34,5 @@ class BackChannelLogin(AuthenticationBase):
34
34
  "scope": scope,
35
35
  **kwargs,
36
36
  },
37
+ headers={"Content-Type": "application/x-www-form-urlencoded"},
37
38
  )
@@ -276,4 +276,39 @@ class GetToken(AuthenticationBase):
276
276
  "auth_req_id": auth_req_id,
277
277
  "grant_type": grant_type,
278
278
  },
279
+ )
280
+
281
+ def access_token_for_connection(
282
+ self,
283
+ subject_token_type: str,
284
+ subject_token: str,
285
+ requested_token_type: str,
286
+ connection: str | None = None,
287
+ grant_type: str = "urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token"
288
+ ) -> Any:
289
+ """Calls /oauth/token endpoint with federated-connection-access-token grant type
290
+
291
+ Args:
292
+ subject_token_type (str): String containing the type of token.
293
+
294
+ subject_token (str): String containing the value of subject_token_type.
295
+
296
+ requested_token_type (str): String containing the type of rquested token.
297
+
298
+ connection (str, optional): Denotes the name of a social identity provider configured to your application
299
+
300
+ Returns:
301
+ access_token, scope, issued_token_type, token_type
302
+ """
303
+
304
+ return self.authenticated_post(
305
+ f"{self.protocol}://{self.domain}/oauth/token",
306
+ data={
307
+ "client_id": self.client_id,
308
+ "grant_type": grant_type,
309
+ "subject_token_type": subject_token_type,
310
+ "subject_token": subject_token,
311
+ "requested_token_type": requested_token_type,
312
+ "connection": connection,
313
+ },
279
314
  )
@@ -537,4 +537,47 @@ class Users:
537
537
  """
538
538
 
539
539
  url = self._url(f"{user_id}/authentication-methods/{authentication_method_id}")
540
- return self.client.delete(url)
540
+ return self.client.delete(url)
541
+
542
+ def list_tokensets(
543
+ self, id: str, page: int = 0, per_page: int = 25, include_totals: bool = True
544
+ ):
545
+ """List all the tokenset(s) associated to the user.
546
+
547
+ Args:
548
+ id (str): The user's id.
549
+
550
+ page (int, optional): The result's page number (zero based). By default,
551
+ retrieves the first page of results.
552
+
553
+ per_page (int, optional): The amount of entries per page. By default,
554
+ retrieves 25 results per page.
555
+
556
+ include_totals (bool, optional): True if the query summary is
557
+ to be included in the result, False otherwise. Defaults to True.
558
+
559
+ See https://auth0.com/docs/api/management/v2#!/Users/get_tokensets
560
+ """
561
+
562
+ params = {
563
+ "per_page": per_page,
564
+ "page": page,
565
+ "include_totals": str(include_totals).lower(),
566
+ }
567
+ url = self._url(f"{id}/federated-connections-tokensets")
568
+ return self.client.get(url, params=params)
569
+
570
+ def delete_tokenset_by_id(
571
+ self, user_id: str, tokenset_id: str
572
+ ) -> Any:
573
+ """Deletes an tokenset by ID.
574
+
575
+ Args:
576
+ user_id (str): The user_id to delete an authentication method by ID for.
577
+ tokenset_id (str): The tokenset_id to delete an tokenset by ID for.
578
+
579
+ See: https://auth0.com/docs/api/management/v2#!/Users/delete_tokenset_by_id
580
+ """
581
+
582
+ url = self._url(f"{user_id}/federated-connections-tokensets/{tokenset_id}")
583
+ return self.client.delete(url)
@@ -1,6 +1,7 @@
1
1
 
2
2
  import unittest
3
3
  from unittest import mock
4
+ import json
4
5
 
5
6
  import requests
6
7
  from ...exceptions import Auth0Error, RateLimitError
@@ -74,5 +75,64 @@ class TestBackChannelLogin(unittest.TestCase):
74
75
  # Assert the error message is correct
75
76
  self.assertIn("missing 1 required positional argument: \'scope\'", str(context.exception))
76
77
 
78
+ @mock.patch("auth0.rest.RestClient.post")
79
+ def test_with_authorization_details(self, mock_post):
80
+ g = BackChannelLogin("my.domain.com", "cid", client_secret="clsec")
81
+ g.back_channel_login(
82
+ binding_message="This is a binding message.",
83
+ login_hint={"format": "iss_sub", "iss": "https://my.domain.auth0.com/", "sub": "auth0|USER_ID"},
84
+ scope="openid",
85
+ authorization_details=[
86
+ {
87
+ "type":"payment_initiation","locations":["https://example.com/payments"],
88
+ "instructedAmount":
89
+ {
90
+ "currency":"EUR","amount":"123.50"
91
+ },
92
+ "creditorName":"Merchant A",
93
+ "creditorAccount":
94
+ {
95
+ "bic":"ABCIDEFFXXX",
96
+ "iban":"DE021001001093071118603"
97
+ },
98
+ "remittanceInformationUnstructured":"Ref Number Merchant"
99
+ }
100
+ ],
101
+ )
102
+
103
+ args, kwargs = mock_post.call_args
104
+
105
+ expected_data = {
106
+ "client_id": "cid",
107
+ "client_secret": "clsec",
108
+ "binding_message": "This is a binding message.",
109
+ "login_hint": {"format": "iss_sub", "iss": "https://my.domain.auth0.com/", "sub": "auth0|USER_ID" },
110
+ "scope": "openid",
111
+ "authorization_details": [
112
+ {
113
+ "type":"payment_initiation","locations":["https://example.com/payments"],
114
+ "instructedAmount":
115
+ {
116
+ "currency":"EUR","amount":"123.50"
117
+ },
118
+ "creditorName":"Merchant A",
119
+ "creditorAccount":
120
+ {
121
+ "bic":"ABCIDEFFXXX",
122
+ "iban":"DE021001001093071118603"
123
+ },
124
+ "remittanceInformationUnstructured":"Ref Number Merchant"
125
+ }],
126
+ }
127
+
128
+ actual_data = kwargs["data"]
129
+
130
+ self.assertEqual(args[0], "https://my.domain.com/bc-authorize")
131
+
132
+ self.assertEqual(
133
+ json.dumps(actual_data, sort_keys=True),
134
+ json.dumps(expected_data, sort_keys=True)
135
+ )
136
+
77
137
 
78
138
 
@@ -334,4 +334,34 @@ class TestGetToken(unittest.TestCase):
334
334
  "auth_req_id": "reqid",
335
335
  "grant_type": "urn:openid:params:grant-type:ciba",
336
336
  },
337
+ )
338
+
339
+ @mock.patch("auth0.rest.RestClient.post")
340
+ def test_connection_login(self, mock_post):
341
+ g = GetToken("my.domain.com", "cid", client_secret="csec")
342
+
343
+ g.access_token_for_connection(
344
+ grant_type="urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",
345
+ subject_token_type="urn:ietf:params:oauth:token-type:refresh_token",
346
+ subject_token="refid",
347
+ requested_token_type="http://auth0.com/oauth/token-type/federated-connection-access-token",
348
+ connection="google-oauth2"
349
+ )
350
+
351
+ args, kwargs = mock_post.call_args
352
+
353
+ print(kwargs["data"])
354
+
355
+ self.assertEqual(args[0], "https://my.domain.com/oauth/token")
356
+ self.assertEqual(
357
+ kwargs["data"],
358
+ {
359
+ "grant_type": "urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",
360
+ "client_id": "cid",
361
+ "client_secret": "csec",
362
+ "subject_token_type": "urn:ietf:params:oauth:token-type:refresh_token",
363
+ "subject_token": "refid",
364
+ "requested_token_type": "http://auth0.com/oauth/token-type/federated-connection-access-token",
365
+ "connection": "google-oauth2"
366
+ },
337
367
  )
@@ -48,7 +48,7 @@ class TestRevokeToken(unittest.TestCase):
48
48
  )
49
49
 
50
50
  @mock.patch("auth0.rest.RestClient.post")
51
- def test_rar(self, mock_post):
51
+ def test_with_authorization_details(self, mock_post):
52
52
  a = PushedAuthorizationRequests("my.domain.com", "cid", client_secret="sh!")
53
53
  a.pushed_authorization_request(
54
54
  response_type="code",
@@ -402,4 +402,37 @@ class TestUsers(unittest.TestCase):
402
402
 
403
403
  mock_instance.delete.assert_called_with(
404
404
  "https://domain/api/v2/users/user_id/authentication-methods/authentication_method_id"
405
+ )
406
+
407
+ @mock.patch("auth0.management.users.RestClient")
408
+ def test_list_tokensets(self, mock_rc):
409
+ mock_instance = mock_rc.return_value
410
+
411
+ u = Users(domain="domain", token="jwttoken")
412
+ u.list_tokensets("an-id")
413
+
414
+ args, kwargs = mock_instance.get.call_args
415
+ self.assertEqual("https://domain/api/v2/users/an-id/federated-connections-tokensets", args[0])
416
+ self.assertEqual(
417
+ kwargs["params"], {"per_page": 25, "page": 0, "include_totals": "true"}
418
+ )
419
+
420
+ u.list_tokensets(id="an-id", page=1, per_page=50, include_totals=False)
421
+
422
+ args, kwargs = mock_instance.get.call_args
423
+
424
+ self.assertEqual("https://domain/api/v2/users/an-id/federated-connections-tokensets", args[0])
425
+ self.assertEqual(
426
+ kwargs["params"], {"per_page": 50, "page": 1, "include_totals": "false"}
427
+ )
428
+
429
+ @mock.patch("auth0.management.users.RestClient")
430
+ def test_delete_tokenset_by_id(self, mock_rc):
431
+ mock_instance = mock_rc.return_value
432
+
433
+ u = Users(domain="domain", token="jwttoken")
434
+ u.delete_tokenset_by_id("user_id", "tokenset_id")
435
+
436
+ mock_instance.delete.assert_called_with(
437
+ "https://domain/api/v2/users/user_id/federated-connections-tokensets/tokenset_id"
405
438
  )
@@ -4,7 +4,7 @@ build-backend = "poetry_dynamic_versioning.backend"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "auth0-python"
7
- version = "4.8.1" # This is replaced by dynamic versioning
7
+ version = "4.9.0" # This is replaced by dynamic versioning
8
8
  description = ""
9
9
  authors = ["Auth0 <support@auth0.com>"]
10
10
  license = "MIT"
File without changes
File without changes
File without changes