Skip to content
This repository was archived by the owner on Jun 12, 2021. It is now read-only.

Commit e9830e8

Browse files
committed
Initial load
1 parent f937779 commit e9830e8

20 files changed

+6286
-0
lines changed

Diff for: .gitignore

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# IntelliJ project folder
2+
.idea
3+
4+
# Other dev-env folders and files
5+
.vagrant
6+
Vagrantfile
7+
8+
# setup.py-related folders and files
9+
build
10+
dist
11+
*.egg-info
12+
*.egg
13+
*.eggs
14+
15+
# Compiled files
16+
*.pyc
17+
18+
# Logs
19+
*.log
20+
*.log.*
21+
22+
# Tox testing
23+
.tox
24+
private/
25+
tmp/
26+
keys/
27+
secret/
28+
pyoidc*
29+
foo.*
30+
31+
# Dynamically created doc folders
32+
doc/_build
33+
!tests/data/keys
34+
35+
# Remaining stuff
36+
oidc_example/op1/client_db.db
37+
oidc_example/op1/oc_config.py
38+
oidc_example/op2/client_db.db
39+
oidc_example/op2/config.py
40+
oidc_example/op2/modules
41+
oidc_example/op2/sp.xml
42+
oidc_example/op2/sp_cert/tmp_mycert.pem
43+
oidc_example/op2/sp_cert/tmp_mykey.pem
44+
oidc_example/op2/sp_conf.py
45+
oidc_example/op2/static/jwks.json
46+
oidc_example/rp3/conf.py
47+
oidc_example/rp3/modules/
48+
update

Diff for: CHANGELOG.md

+139
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Change Log
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on the [KeepAChangeLog] project.
5+
6+
[KeepAChangeLog]: http://keepachangelog.com/
7+
8+
## 0.13.0 [Unreleased]
9+
10+
### Fixed
11+
- [#430] Skip keys that are of unknown type or under defined.
12+
- [#430] Audience of a client assertion is endpoint dependent.
13+
- [#427] Made matching for response_types order independent for authorization requests
14+
- [#399] Matching response_types for authz requests is too strict
15+
16+
[#431]: https://github.com/OpenIDC/pyoidc/pull/431
17+
[#430]: https://github.com/OpenIDC/pyoidc/pull/430
18+
[#427]: https://github.com/OpenIDC/pyoidc/pull/427
19+
[#399]: https://github.com/OpenIDC/pyoidc/issues/399
20+
21+
## 0.12.0 [2017-09-25]
22+
23+
### Fixed
24+
- [#419]: Inconsistent release numbers/tags
25+
- [#420]: Distributed claims
26+
27+
[#419]: https://github.com/OpenIDC/pyoidc/issues/419
28+
[#420]: https://github.com/OpenIDC/pyoidc/pull/420
29+
30+
## 0.11.1.0 [2017-08-26]
31+
32+
### Fixed
33+
- [#405]: Fix generation of endpoint urls
34+
- [#411]: Empty lists not indexable
35+
- [#413]: Fix error when wrong response_mode requested
36+
- [#418]: Made phone_number_claim be boolean and fixed a bug when importing JSON (non-boolean where boolean expected)
37+
38+
[#418]: https://github.com/OpenIDC/pyoidc/pull/418
39+
[#411]: https://github.com/OpenIDC/pyoidc/issues/411
40+
[#405]: https://github.com/OpenIDC/pyoidc/issues/405
41+
[#413]: https://github.com/OpenIDC/pyoidc/issues/413
42+
43+
## 0.11.0.0 [2017-07-07]
44+
45+
### Changed
46+
- [#318]: `oic.utils.authn.saml` raises `ImportError` on import if optional `saml2` dependency is not present.
47+
- [#324]: Make the Provider `symkey` argument optional.
48+
- [#325]: `oic.oic.claims_match` implementation refactored.
49+
- [#368]: `oic.oauth2.Client.construct_AccessTokenRequest()` as well as `oic.oic.Client` are now able to perform proper Resource Owner Password Credentials Grant
50+
- [#374]: Made the to_jwe/from_jwe methods of Message accept list of keys value of parameter keys.
51+
- [#387]: Refactored the `oic.utils.sdb.SessionDB` constructor API.
52+
- [#380]: Made cookie_path and cookie_domain configurable via Provider like the cookie_name.
53+
- [#386]: An exception will now be thrown if a sub claim received from the userinfo endpoint is not the same as a sub claim previously received in an ID Token.
54+
- [#392]: Made sid creation simpler and faster
55+
56+
### Fixed
57+
- [#317]: Resolved an `AttibuteError` exception under Python 2.
58+
- [#313]: Catch exception correctly
59+
- [#319]: Fix sanitize on strings starting with "B" or "U"
60+
- [#330]: Fix client_management user input being eval'd under Python 2
61+
- [#358]: Fixed claims_match
62+
- [#362]: Fix bad package settings URL
63+
- [#369]: The AuthnEvent object is now serialized to JSON for the session.
64+
- [#373]: Made the standard way the default when dealing with signed JWTs without 'kid'. Added the possibility to override this behavior if necessary.
65+
- [#401]: Fixed message decoding and verifying errors.
66+
67+
### Security
68+
- [#349]: Changed crypto algorithm used by `oic.utils.sdb.Crypt` for token encryption to Fernet. Old stored tokens are incompatible.
69+
- [#363]: Fixed IV reuse for CookieDealer class. Replaced the encrypt-then-mac construction with a proper AEAD (AES-SIV).
70+
71+
[#401]: https://github.com/OpenIDC/pyoidc/pull/401
72+
[#386]: https://github.com/OpenIDC/pyoidc/pull/386
73+
[#380]: https://github.com/OpenIDC/pyoidc/pull/380
74+
[#317]: https://github.com/OpenIDC/pyoidc/pull/317
75+
[#313]: https://github.com/OpenIDC/pyoidc/issues/313
76+
[#387]: https://github.com/OpenIDC/pyoidc/pull/387
77+
[#318]: https://github.com/OpenIDC/pyoidc/pull/318
78+
[#319]: https://github.com/OpenIDC/pyoidc/pull/319
79+
[#324]: https://github.com/OpenIDC/pyoidc/pull/324
80+
[#325]: https://github.com/OpenIDC/pyoidc/pull/325
81+
[#330]: https://github.com/OpenIDC/pyoidc/issues/330
82+
[#349]: https://github.com/OpenIDC/pyoidc/issues/349
83+
[#358]: https://github.com/OpenIDC/pyoidc/pull/358
84+
[#362]: https://github.com/OpenIDC/pyoidc/pull/362
85+
[#363]: https://github.com/OpenIDC/pyoidc/issue/363
86+
[#368]: https://github.com/OpenIDC/pyoidc/issues/368
87+
[#369]: https://github.com/OpenIDC/pyoidc/pull/369
88+
[#373]: https://github.com/OpenIDC/pyoidc/pull/373
89+
[#374]: https://github.com/OpenIDC/pyoidc/pull/374
90+
[#392]: https://github.com/OpenIDC/pyoidc/issue/392
91+
92+
## 0.10.0.0 [2017-03-28]
93+
94+
### Changed
95+
- [#291]: Testing more relevant Python versions.
96+
- [#296]: `parse_qs` import from `future.backports` to `future.moves`.
97+
- [#188]: Added `future` dependency, updated dependecies
98+
- [#305]: Some import were removed from `oic.oauth2` and `oic.oic.provider`, please import them from respective modules (`oic.oath2.message` and `oic.exception`).
99+
100+
### Removed
101+
- [#294]: Generating code indices in documentation.
102+
103+
### Fixed
104+
- [#295]: Access token issuance and typo/exception handling.
105+
106+
[#291]: https://github.com/OpenIDC/pyoidc/pull/291
107+
[#294]: https://github.com/OpenIDC/pyoidc/pull/294
108+
[#295]: https://github.com/OpenIDC/pyoidc/pull/295
109+
[#296]: https://github.com/OpenIDC/pyoidc/pull/296
110+
[#188]: https://github.com/OpenIDC/pyoidc/issues/188
111+
[#305]: https://github.com/OpenIDC/pyoidc/pull/305
112+
113+
## 0.9.5.0 [2017-03-22]
114+
115+
### Added
116+
- [#276]: Use a Change log for change history.
117+
- [#277]: Use pip-tools for dependency management.
118+
119+
[#276]: https://github.com/OpenIDC/pyoidc/pull/276
120+
[#277]: https://github.com/OpenIDC/pyoidc/pull/277
121+
122+
### Removed
123+
- [#274]: Moved `oidc_fed` to [fedoidc].
124+
125+
[#274]: https://github.com/OpenIDC/pyoidc/pull/274
126+
[fedoidc]: https://github.com/OpenIDC/fedoidc
127+
128+
### Changed
129+
- [#273]: Allow webfinger accept `kwargs`.
130+
131+
[#273]: https://github.com/OpenIDC/pyoidc/pull/273
132+
133+
### Fixed
134+
- [#286]: Account for missing code in the SessionDB.
135+
136+
[#286]: https://github.com/OpenIDC/pyoidc/pulls/286
137+
138+
## 0.9.4.0 [2016-12-22]
139+
No change log folks. Sorry.

Diff for: LICENSE.txt

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright (C) 2017 Roland Hedberg, Sweden
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

Diff for: Makefile

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
PROJECT_ROOT:=.
2+
3+
SPHINXOPTS =
4+
SPHINXBUILD = sphinx-build
5+
SPHINXABUILD = sphinx-autobuild
6+
BUILDDIR = doc/_build
7+
DOCDIR = doc/
8+
OICDIR = src/oicmsg
9+
TESTDIR = tests
10+
11+
help:
12+
@echo "Please use \`make <target>' where <target> is one of"
13+
@echo " html to make HTML documentation files"
14+
@echo " livehtml to make HTML documentation files (live reload!)"
15+
@echo " install to install the python dependencies for development"
16+
@echo " isort to sort imports"
17+
.PHONY: help
18+
19+
clean:
20+
rm -rf $(BUILDDIR)/*
21+
.PHONY: clean
22+
23+
ALLSPHINXOPTS=-W
24+
html:
25+
@pipenv run $(SPHINXBUILD) -b html $(DOCDIR) $(BUILDDIR)/html $(ALLSPHINXOPTS)
26+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
27+
.PHONY: html
28+
29+
livehtml:
30+
@pipenv run $(SPHINXABUILD) -b html $(DOCDIR) $(BUILDDIR)/html $(ALLSPHINXOPTS)
31+
@echo "Build finished. Watching for change ..."
32+
.PHONY: livehtml
33+
34+
install:
35+
@pipenv install --dev
36+
.PHONY: install
37+
38+
test:
39+
@pipenv run pytest $(TESTDIR)
40+
.PHONY: test
41+
42+
isort:
43+
@pipenv run isort --recursive $(OICDIR) $(TESTDIR)
44+
45+
check-isort:
46+
@pipenv run isort --recursive --diff --check-only $(OICDIR) $(TESTDIR)
47+
.PHONY: isort check-isort
48+
49+
check-pylama:
50+
@pipenv run pylama $(OICDIR) $(TESTDIR)
51+
.PHONY: check-pylama
52+
53+
release:
54+
@pipenv run python setup.py sdist upload -r pypi
55+
.PHONY: release

Diff for: pylama.ini

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[pylama:pycodestyle]
2+
max_line_length = 120
3+
4+
[pylama:mccabe]
5+
complexity = 40

Diff for: setup.py

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/usr/bin/env python
2+
#
3+
# Copyright (C) 2017 Roland Hedberg, Sweden
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
import re
18+
import sys
19+
20+
from setuptools import setup
21+
from setuptools.command.test import test as TestCommand
22+
23+
__author__ = 'Roland Hedberg'
24+
25+
26+
class PyTest(TestCommand):
27+
def finalize_options(self):
28+
TestCommand.finalize_options(self)
29+
self.test_args = []
30+
self.test_suite = True
31+
32+
def run_tests(self):
33+
# import here, cause outside the eggs aren't loaded
34+
import pytest
35+
36+
errno = pytest.main(self.test_args)
37+
sys.exit(errno)
38+
39+
40+
# Python 2.7 and later ship with importlib and argparse
41+
if sys.version_info[0] == 2 and sys.version_info[1] == 6:
42+
extra_install_requires = ["importlib", "argparse"]
43+
else:
44+
extra_install_requires = []
45+
46+
version = ''
47+
with open('src/oiccli/__init__.py', 'r') as fd:
48+
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
49+
fd.read(), re.MULTILINE).group(1)
50+
51+
setup(
52+
name="oiccli",
53+
version=version,
54+
description="Python implementation of OAuth2 and OpenID Connect client",
55+
author="Roland Hedberg",
56+
author_email="[email protected]",
57+
license="Apache 2.0",
58+
url='https://github.com/IdentityPython/oicmsg/',
59+
packages=["oiccli", "oiccli/oauth2", "oiccli/oic"],
60+
package_dir={"": "src"},
61+
classifiers=[
62+
"Development Status :: 4 - Beta",
63+
"License :: OSI Approved :: Apache Software License",
64+
"Programming Language :: Python :: 2.7",
65+
"Programming Language :: Python :: 3.4",
66+
"Programming Language :: Python :: 3.5",
67+
"Programming Language :: Python :: 3.6",
68+
"Topic :: Software Development :: Libraries :: Python Modules"],
69+
install_requires=[
70+
"pyjwkest>=1.3.6",
71+
"future",
72+
"six",
73+
],
74+
tests_require=[
75+
"responses",
76+
"testfixtures",
77+
],
78+
zip_safe=False,
79+
cmdclass={'test': PyTest},
80+
)

Diff for: src/oiccli/__init__.py

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import hashlib
2+
import string
3+
4+
# Since SystemRandom is not available on all systems
5+
try:
6+
import random.SystemRandom as rnd
7+
except ImportError:
8+
import random as rnd
9+
10+
__author__ = 'Roland Hedberg'
11+
__version__ = '0.0.1'
12+
13+
14+
OIDCONF_PATTERN = "%s/.well-known/openid-configuration"
15+
CC_METHOD = {
16+
'S256': hashlib.sha256,
17+
'S384': hashlib.sha384,
18+
'S512': hashlib.sha512,
19+
}
20+
21+
22+
def rndstr(size=16):
23+
"""
24+
Returns a string of random ascii characters or digits
25+
26+
:param size: The length of the string
27+
:return: string
28+
"""
29+
_basech = string.ascii_letters + string.digits
30+
return "".join([rnd.choice(_basech) for _ in range(size)])
31+
32+
33+
BASECH = string.ascii_letters + string.digits + '-._~'
34+
35+
36+
def unreserved(size=64):
37+
"""
38+
Returns a string of random ascii characters, digits and unreserved
39+
characters
40+
41+
:param size: The length of the string
42+
:return: string
43+
"""
44+
45+
return "".join([rnd.choice(BASECH) for _ in range(size)])
46+
47+
48+
def sanitize(str):
49+
return str

0 commit comments

Comments
 (0)