Skip to content

Commit 6d08586

Browse files
revert: Reverting Access Token For Conn Changes (#675)
### Changes - Reverting the Access Token For Connection Changes. ### Testing - [x] This change adds test coverage - [x] This change has been tested on the latest version of the platform/language or why not ### Contributor Checklist - [x] I agree to adhere to the [Auth0 General Contribution Guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md). - [x] I agree to uphold the [Auth0 Code of Conduct](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md).
1 parent 4942c93 commit 6d08586

File tree

4 files changed

+3
-144
lines changed

4 files changed

+3
-144
lines changed

auth0/authentication/get_token.py

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -276,39 +276,4 @@ def backchannel_login(
276276
"auth_req_id": auth_req_id,
277277
"grant_type": grant_type,
278278
},
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-
},
314-
)
279+
)

auth0/management/users.py

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -537,47 +537,4 @@ def delete_authentication_method_by_id(
537537
"""
538538

539539
url = self._url(f"{user_id}/authentication-methods/{authentication_method_id}")
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}/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}/tokensets/{tokenset_id}")
583-
return self.client.delete(url)
540+
return self.client.delete(url)

auth0/test/authentication/test_get_token.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -334,34 +334,4 @@ def test_backchannel_login(self, mock_post):
334334
"auth_req_id": "reqid",
335335
"grant_type": "urn:openid:params:grant-type:ciba",
336336
},
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-
},
367337
)

auth0/test/management/test_users.py

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -402,37 +402,4 @@ def test_delete_authentication_method_by_id(self, mock_rc):
402402

403403
mock_instance.delete.assert_called_with(
404404
"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/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/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/tokensets/tokenset_id"
438-
)
405+
)

0 commit comments

Comments
 (0)