aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorjuerg <juerg@google.com>2023-07-12 02:39:16 -0700
committerCopybara-Service <copybara-worker@google.com>2023-07-12 02:40:34 -0700
commit47a564b222b16e8a5858a761fd7d87fba375b76e (patch)
treec9154c1a77c1702f3ec3e0feca390eb81af8e124 /python
parent2ffc4d982da879fdff6ffd3223b0846d60f5f16e (diff)
downloadtink-47a564b222b16e8a5858a761fd7d87fba375b76e.tar.gz
Small fixes in python JWT examples.
PiperOrigin-RevId: 547437927
Diffstat (limited to 'python')
-rw-r--r--python/examples/jwt/jwt_generate_public_jwk_set.py4
-rw-r--r--python/examples/jwt/jwt_verify.py7
2 files changed, 6 insertions, 5 deletions
diff --git a/python/examples/jwt/jwt_generate_public_jwk_set.py b/python/examples/jwt/jwt_generate_public_jwk_set.py
index cecd2cfd2..a8143be46 100644
--- a/python/examples/jwt/jwt_generate_public_jwk_set.py
+++ b/python/examples/jwt/jwt_generate_public_jwk_set.py
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# [START python-jwt-sign-example]
+# [START python-jwt-jwkset-example]
"""A utility for generating the public JWK set from the public keyset.
"""
@@ -62,4 +62,4 @@ if __name__ == '__main__':
flags.mark_flags_as_required(['public_keyset_path', 'public_jwk_set_path'])
app.run(main)
-# [END python-jwt-sign-example]
+# [END python-jwt-jwkset-example]
diff --git a/python/examples/jwt/jwt_verify.py b/python/examples/jwt/jwt_verify.py
index 991a9e295..af59abfb5 100644
--- a/python/examples/jwt/jwt_verify.py
+++ b/python/examples/jwt/jwt_verify.py
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# [START python-jwt-signature-example]
+# [START python-jwt-verify-example]
"""A utility for verifying Json Web Tokens (JWT)."""
import datetime
@@ -65,8 +65,9 @@ def main(argv):
logging.exception('Error reading public JWK set: %s', e)
return 1
else:
- logging.info(
+ logging.exception(
'Either --public_keyset_path or --public_jwk_set_path must be set')
+ return 1
now = datetime.datetime.now(tz=datetime.timezone.utc)
try:
@@ -93,4 +94,4 @@ if __name__ == '__main__':
flags.mark_flags_as_required(['audience', 'token_path'])
app.run(main)
-# [END python-jwt-signature-example]
+# [END python-jwt-verify-example]