Skip to content

Commit 1f2a266

Browse files
authored
Releasing version 1.4.5 (oracle#64)
Release V1.4.5
1 parent d678616 commit 1f2a266

34 files changed

+2419
-25
lines changed

CHANGELOG.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on `Keep a Changelog <http://keepachangelog.com/>`_.
66

7+
====================
8+
1.4.5 - 2018-07-12
9+
====================
10+
11+
Added
12+
-----
13+
* Support for tagging Load Balancers in the Load Balancing service
14+
* Support for export options in the File Storage service
15+
* Support for retrieving compartment name and user name as part of events in the Audit service
16+
17+
Changed
18+
-------
19+
* Setup.py updated to allow more version of cryptography when installing to an existing environment
20+
* Add PyJWT as a vendored package
21+
22+
723
====================
824
1.4.4 - 2018-06-28
925
====================

Thirdpartyreadme.txt

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,22 @@ httpsig_cffi
22
=============
33
Copyright (c) 2014 Adam Knight
44
Copyright (c) 2012 Adam T. Lindsay (original author)
5-
5+
66
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7-
7+
88
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9-
9+
10+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11+
12+
PyJWT
13+
=====
14+
The MIT License (MIT)
15+
16+
Copyright (c) 2015 José Padilla
17+
18+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights
19+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
20+
21+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
22+
1023
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
certifi
22
configparser==3.5.0
33
coverage==4.4.1
4-
cryptography==2.1.3
4+
cryptography>=2.1.3,<=2.2.2
55
flake8==3.5.0
66
mock==2.0.0
7-
PyJWT==1.5.3
87
pyOpenSSL==17.4.0
98
pytest==3.2.3
109
pytest-catchlog==1.2.2

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ exclude =
1010
docs/conf.py,
1111
build,
1212
dist,
13+
src/oci/_vendor
1314
max-line-length = 99
1415

1516
[metadata]

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ def open_relative(*path):
3131
requires = [
3232
"certifi",
3333
"configparser==3.5.0",
34-
"cryptography==2.1.3",
34+
"cryptography>=2.1.3,<=2.2.2",
3535
"idna>=2.5,<2.7",
36-
"PyJWT==1.5.3",
3736
"pyOpenSSL<=17.4.0",
3837
"python-dateutil>=2.5.3,<=2.7.3",
3938
"pytz>=2016.10",

src/oci/_vendor/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
33

44
from . import httpsig_cffi # noqa: F401
5+
from . import jwt # noqa: F401

src/oci/_vendor/jwt/__init__.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# coding: utf-8
2+
# Modified Work: Copyright (c) 2018, 2018, Oracle and/or its affiliates. All rights reserved.
3+
# Original Work: Copyright (c) 2015 José Padilla
4+
5+
# -*- coding: utf-8 -*-
6+
# flake8: noqa
7+
8+
"""
9+
JSON Web Token implementation
10+
11+
Minimum implementation based on this spec:
12+
http://self-issued.info/docs/draft-jones-json-web-token-01.html
13+
"""
14+
15+
16+
__title__ = 'pyjwt'
17+
__version__ = '1.5.3'
18+
__author__ = 'José Padilla'
19+
__license__ = 'MIT'
20+
__copyright__ = 'Copyright 2015 José Padilla'
21+
22+
23+
from .api_jwt import (
24+
encode, decode, register_algorithm, unregister_algorithm,
25+
get_unverified_header, PyJWT
26+
)
27+
from .api_jws import PyJWS
28+
from .exceptions import (
29+
InvalidTokenError, DecodeError, InvalidAlgorithmError,
30+
InvalidAudienceError, ExpiredSignatureError, ImmatureSignatureError,
31+
InvalidIssuedAtError, InvalidIssuerError, ExpiredSignature,
32+
InvalidAudience, InvalidIssuer, MissingRequiredClaimError
33+
)

src/oci/_vendor/jwt/__main__.py

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# coding: utf-8
2+
# Modified Work: Copyright (c) 2018, 2018, Oracle and/or its affiliates. All rights reserved.
3+
# Original Work: Copyright (c) 2015 José Padilla
4+
5+
#!/usr/bin/env python
6+
7+
from __future__ import absolute_import, print_function
8+
9+
import argparse
10+
import json
11+
import sys
12+
import time
13+
14+
from . import DecodeError, __version__, decode, encode
15+
16+
17+
def encode_payload(args):
18+
# Try to encode
19+
if args.key is None:
20+
raise ValueError('Key is required when encoding. See --help for usage.')
21+
22+
# Build payload object to encode
23+
payload = {}
24+
25+
for arg in args.payload:
26+
k, v = arg.split('=', 1)
27+
28+
# exp +offset special case?
29+
if k == 'exp' and v[0] == '+' and len(v) > 1:
30+
v = str(int(time.time()+int(v[1:])))
31+
32+
# Cast to integer?
33+
if v.isdigit():
34+
v = int(v)
35+
else:
36+
# Cast to float?
37+
try:
38+
v = float(v)
39+
except ValueError:
40+
pass
41+
42+
# Cast to true, false, or null?
43+
constants = {'true': True, 'false': False, 'null': None}
44+
45+
if v in constants:
46+
v = constants[v]
47+
48+
payload[k] = v
49+
50+
token = encode(
51+
payload,
52+
key=args.key,
53+
algorithm=args.algorithm
54+
)
55+
56+
return token.decode('utf-8')
57+
58+
59+
def decode_payload(args):
60+
try:
61+
if sys.stdin.isatty():
62+
token = sys.stdin.read()
63+
else:
64+
token = args.token
65+
66+
token = token.encode('utf-8')
67+
data = decode(token, key=args.key, verify=args.verify)
68+
69+
return json.dumps(data)
70+
71+
except DecodeError as e:
72+
raise DecodeError('There was an error decoding the token: %s' % e)
73+
74+
75+
def build_argparser():
76+
77+
usage = '''
78+
Encodes or decodes JSON Web Tokens based on input.
79+
80+
%(prog)s [options] <command> [options] input
81+
82+
Decoding examples:
83+
84+
%(prog)s --key=secret decode json.web.token
85+
%(prog)s decode --no-verify json.web.token
86+
87+
Encoding requires the key option and takes space separated key/value pairs
88+
separated by equals (=) as input. Examples:
89+
90+
%(prog)s --key=secret encode iss=me exp=1302049071
91+
%(prog)s --key=secret encode foo=bar exp=+10
92+
93+
The exp key is special and can take an offset to current Unix time.
94+
'''
95+
96+
arg_parser = argparse.ArgumentParser(
97+
prog='pyjwt',
98+
usage=usage
99+
)
100+
101+
arg_parser.add_argument(
102+
'-v', '--version',
103+
action='version',
104+
version='%(prog)s ' + __version__
105+
)
106+
107+
arg_parser.add_argument(
108+
'--key',
109+
dest='key',
110+
metavar='KEY',
111+
default=None,
112+
help='set the secret key to sign with'
113+
)
114+
115+
arg_parser.add_argument(
116+
'--alg',
117+
dest='algorithm',
118+
metavar='ALG',
119+
default='HS256',
120+
help='set crypto algorithm to sign with. default=HS256'
121+
)
122+
123+
subparsers = arg_parser.add_subparsers(
124+
title='PyJWT subcommands',
125+
description='valid subcommands',
126+
help='additional help'
127+
)
128+
129+
# Encode subcommand
130+
encode_parser = subparsers.add_parser('encode', help='use to encode a supplied payload')
131+
132+
payload_help = """Payload to encode. Must be a space separated list of key/value
133+
pairs separated by equals (=) sign."""
134+
135+
encode_parser.add_argument('payload', nargs='+', help=payload_help)
136+
encode_parser.set_defaults(func=encode_payload)
137+
138+
# Decode subcommand
139+
decode_parser = subparsers.add_parser('decode', help='use to decode a supplied JSON web token')
140+
decode_parser.add_argument('token', help='JSON web token to decode.')
141+
142+
decode_parser.add_argument(
143+
'-n', '--no-verify',
144+
action='store_false',
145+
dest='verify',
146+
default=True,
147+
help='ignore signature and claims verification on decode'
148+
)
149+
150+
decode_parser.set_defaults(func=decode_payload)
151+
152+
return arg_parser
153+
154+
155+
def main():
156+
arg_parser = build_argparser()
157+
158+
try:
159+
arguments = arg_parser.parse_args(sys.argv[1:])
160+
161+
output = arguments.func(arguments)
162+
163+
print(output)
164+
except Exception as e:
165+
print('There was an unforseen error: ', e)
166+
arg_parser.print_help()

0 commit comments

Comments
 (0)