@@ -0,0 +1,903 @@
+import argparse%0Aimport sys%0Afrom typing import List%0A%0Aimport jwt%0A%0Afrom monitoring.monitorlib import auth_validation%0A%0A%0Adef parse_args(argv: List%5Bstr%5D):%0A    parser = argparse.ArgumentParser(description='Validate an access token')%0A    parser.add_argument(%0A        '--token', action='store', dest='token', type=str,%0A        help='JWT access token to be validated')%0A    parser.add_argument(%0A        '--key', action='store', dest='key', type=str,%0A        help='Public key to validate against.  May be PEM-format text or a URL to a JWKS or plaintext PEM file.')%0A    return parser.parse_args(argv)%0A%0A%0Adef get_access_token_payload(token: str, public_key: str):%0A    key = auth_validation.fix_key(public_key)%0A    return jwt.decode(token, key, algorithms='RS256', options=%7B'verify_aud': False%7D)%0A%0A%0Aif __name__ == '__main__':%0A    args = parse_args(sys.argv%5B1:%5D)%0A    print(get_access_token_payload(args.token, args.key))%0A

Add tool to validate access tokens (#709)