diff options
author | Geoff Richards <geoff@geoffrichards.co.uk> | 2020-06-16 07:06:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-16 12:06:52 +0600 |
commit | 5de3023c4c95554b70a455da5fa75b3d17478d89 (patch) | |
tree | d1d37a5802cc3f98a2819d7dfae7e703662d1604 | |
parent | 2194df2fc223313faf78b4866c2fd6ceda5ee797 (diff) | |
download | pyjwt-5de3023c4c95554b70a455da5fa75b3d17478d89.tar.gz |
CLI options for verifying audience and issuer (#496)
-rw-r--r-- | jwt/__main__.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/jwt/__main__.py b/jwt/__main__.py index d1e3050..4fd3d33 100644 --- a/jwt/__main__.py +++ b/jwt/__main__.py @@ -71,7 +71,8 @@ def decode_payload(args): raise OSError("Cannot read from stdin: terminal not a TTY") token = token.encode("utf-8") - data = decode(token, key=args.key, verify=args.verify) + data = decode(token, key=args.key, verify=args.verify, + audience=args.audience, issuer=args.issuer) return json.dumps(data) @@ -170,6 +171,22 @@ def build_argparser(): help="ignore signature and claims verification on decode", ) + decode_parser.add_argument( + "--audience", + action="append", + dest="audience", + default=None, + help="audience value to accept, can be given multiple times", + ) + + decode_parser.add_argument( + "--issuer", + action="store", + dest="issuer", + default=None, + help="require issuer to match this, if specified", + ) + decode_parser.set_defaults(func=decode_payload) return arg_parser |