From d853c08984526bb8247320753ba9752f620caac9 Mon Sep 17 00:00:00 2001 From: Luciano Balmaceda Date: Mon, 18 Oct 2021 10:57:02 +0200 Subject: [PATCH] remove references to ID token in generic token classes --- auth0/v3/authentication/token_verifier.py | 4 ++-- auth0/v3/test/authentication/test_token_verifier.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/auth0/v3/authentication/token_verifier.py b/auth0/v3/authentication/token_verifier.py index 7e74b693..ea411c01 100644 --- a/auth0/v3/authentication/token_verifier.py +++ b/auth0/v3/authentication/token_verifier.py @@ -58,12 +58,12 @@ def verify_signature(self, token): try: header = jwt.get_unverified_header(token) except jwt.exceptions.DecodeError: - raise TokenValidationError("ID token could not be decoded.") + raise TokenValidationError("token could not be decoded.") alg = header.get('alg', None) if alg != self._algorithm: raise TokenValidationError( - 'Signature algorithm of "{}" is not supported. Expected the ID token ' + 'Signature algorithm of "{}" is not supported. Expected the token ' 'to be signed with "{}"'.format(alg, self._algorithm)) kid = header.get('kid', None) diff --git a/auth0/v3/test/authentication/test_token_verifier.py b/auth0/v3/test/authentication/test_token_verifier.py index befe8789..7ff0eee0 100644 --- a/auth0/v3/test/authentication/test_token_verifier.py +++ b/auth0/v3/test/authentication/test_token_verifier.py @@ -86,13 +86,13 @@ def test_fails_with_none_algorithm(self): verifier = SymmetricSignatureVerifier("some secret") with self.assertRaises(Exception) as err: verifier.verify_signature(jwt) - self.assertEqual(str(err.exception), 'Signature algorithm of "none" is not supported. Expected the ID token to be signed with "HS256"') + self.assertEqual(str(err.exception), 'Signature algorithm of "none" is not supported. Expected the token to be signed with "HS256"') verifier = AsymmetricSignatureVerifier("some url") with self.assertRaises(Exception) as err: verifier.verify_signature(jwt) self.assertEqual(str(err.exception), - 'Signature algorithm of "none" is not supported. Expected the ID token to be signed with "RS256"') + 'Signature algorithm of "none" is not supported. Expected the token to be signed with "RS256"') class TestJwksFetcher(unittest.TestCase): @@ -249,11 +249,11 @@ def test_err_token_empty(self): def test_err_token_format_invalid(self): token = "a.b" - self.assert_fails_with_error(token, "ID token could not be decoded.") + self.assert_fails_with_error(token, "token could not be decoded.") token = "a.b." - self.assert_fails_with_error(token, "ID token could not be decoded.") + self.assert_fails_with_error(token, "token could not be decoded.") token = "a.b.c.d" - self.assert_fails_with_error(token, "ID token could not be decoded.") + self.assert_fails_with_error(token, "token could not be decoded.") def test_HS256_token_signature_passes(self): token = "eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3Rva2Vucy10ZXN0LmF1dGgwLmNvbS8iLCJzdWIiOiJhdXRoMHwxMjM0NTY3ODkiLCJhdWQiOlsidG9rZW5zLXRlc3QtMTIzIiwiZXh0ZXJuYWwtdGVzdC05OTkiXSwiZXhwIjoxNTg3NzY1MzYxLCJpYXQiOjE1ODc1OTI1NjEsIm5vbmNlIjoiYTFiMmMzZDRlNSIsImF6cCI6InRva2Vucy10ZXN0LTEyMyIsImF1dGhfdGltZSI6MTU4NzY3ODk2MX0.Hn38QVtN_mWN0c-jOa-Fqq69kXpbBp0THsvE-CQ47Ps" @@ -293,7 +293,7 @@ def test_RS256_token_signature_fails(self): def test_fails_with_algorithm_not_supported(self): token = "eyJhbGciOiJub25lIn0.eyJpc3MiOiJodHRwczovL3Rva2Vucy10ZXN0LmF1dGgwLmNvbS8iLCJzdWIiOiJhdXRoMHwxMjM0NTY3ODkiLCJhdWQiOlsidG9rZW5zLXRlc3QtMTIzIiwiZXh0ZXJuYWwtdGVzdC05OTkiXSwiZXhwIjoxNTg3NzY1MzYxLCJpYXQiOjE1ODc1OTI1NjEsIm5vbmNlIjoiYTFiMmMzZDRlNSIsImF6cCI6InRva2Vucy10ZXN0LTEyMyIsImF1dGhfdGltZSI6MTU4NzY3ODk2MX0." - self.assert_fails_with_error(token, 'Signature algorithm of "none" is not supported. Expected the ID token to be signed with "RS256"') + self.assert_fails_with_error(token, 'Signature algorithm of "none" is not supported. Expected the token to be signed with "RS256"') return def test_fails_with_iss_missing(self):