Skip to content

Commit

Permalink
Merge pull request #883 from CZ-NIC/python-support
Browse files Browse the repository at this point in the history
Update supported python versions
  • Loading branch information
tpazderka authored Nov 27, 2024
2 parents 35b0895 + ad2eb88 commit 0bd1ead
Show file tree
Hide file tree
Showing 117 changed files with 1,900 additions and 3,708 deletions.
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ruff format
59b2965dc8f5f487ba24d148911ac2999d7bbb57
7 changes: 1 addition & 6 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ jobs:
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
Expand All @@ -63,4 +58,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
2 changes: 1 addition & 1 deletion .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python: [3.8, 3.9, "3.10", "3.11"]
python: [3.9, "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
include src/oic/py.typed
include pyproject.toml
18 changes: 0 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,10 @@ test:
@pipenv run pytest $(TESTDIR)
.PHONY: test

isort:
@pipenv run isort $(OICDIR) $(TESTDIR) $(OAUTH_EXAMPLE)

check-isort:
@pipenv run isort --diff --check-only $(OICDIR) $(TESTDIR) $(OAUTH_EXAMPLE)
.PHONY: isort check-isort

blacken:
@pipenv run black src/ tests/ oauth_example/

check-black:
@pipenv run black src/ tests/ oauth_example/ --check
.PHONY: blacken check-black

bandit:
@pipenv run bandit -a file -r src/ oauth_example/ oidc_example/
.PHONY: bandit

check-pylama:
@pipenv run pylama $(OICDIR) $(TESTDIR) $(OAUTH_EXAMPLE)
.PHONY: check-pylama

release:
@pipenv run python setup.py sdist upload -r pypi
.PHONY: release
4 changes: 3 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ image:

environment:
matrix:
- TOXENV: py38
- TOXENV: py39
- TOXENV: py310
- TOXENV: py311
- TOXENV: py312
- TOXENV: py313

build: off

Expand Down
79 changes: 40 additions & 39 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,77 +2,78 @@
import os
import sys

sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'src')))
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "src")))

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'sphinxcontrib.autodoc_pydantic',
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinxcontrib.autodoc_pydantic",
]

autoclass_content = 'both' # Merge the __init__ docstring into the class docstring.
autodoc_member_order = 'bysource' # Order by source ordering
autoclass_content = "both" # Merge the __init__ docstring into the class docstring.
autodoc_member_order = "bysource" # Order by source ordering
autodoc_pydantic_model_show_config = True
autodoc_pydantic_settings_show_json = False

templates_path = ['_templates']
templates_path = ["_templates"]

source_suffix = '.rst'
source_suffix = ".rst"

master_doc = 'index'
master_doc = "index"

project = u'pyoidc'
project = "pyoidc"

copyright = u'2014, Roland Hedberg'
copyright = "2014, Roland Hedberg"

version = '0.1'
version = "0.1"

release = '0.1'
release = "0.1"

exclude_patterns = ['_build']
exclude_patterns = ["_build"]

pygments_style = 'sphinx'
pygments_style = "sphinx"

html_theme_path = [alabaster.get_path()]

html_theme = 'alabaster'
html_theme = "alabaster"

html_static_path = ['_static']
html_static_path = ["_static"]

htmlhelp_basename = 'pyoidcdoc'
htmlhelp_basename = "pyoidcdoc"

html_theme_options = {
'description': '',
'github_button': False,
'github_user': 'its-dirg',
'github_repo': 'saml2testGui',
'github_banner': False,

"description": "",
"github_button": False,
"github_user": "its-dirg",
"github_repo": "saml2testGui",
"github_banner": False,
}

html_sidebars = {
'**': [
'about.html',
'navigation.html',
'searchbox.html',
'donate.html',
]
"**": [
"about.html",
"navigation.html",
"searchbox.html",
"donate.html",
]
}

man_pages = [
('index', 'pyoidc', u'pyoidc Documentation',
[u'Roland Hedberg'], 1)
]
man_pages = [("index", "pyoidc", "pyoidc Documentation", ["Roland Hedberg"], 1)]

latex_elements = {}

latex_documents = [
('index', 'pyoidc.tex', u'pyoidc Documentation',
u'Roland Hedberg', 'manual'),
("index", "pyoidc.tex", "pyoidc Documentation", "Roland Hedberg", "manual"),
]

texinfo_documents = [
('index', 'pyoidc', u'pyoidc Documentation',
u'Roland Hedberg', 'pyoidc', 'One line description of project.',
'Miscellaneous'),
(
"index",
"pyoidc",
"pyoidc Documentation",
"Roland Hedberg",
"pyoidc",
"One line description of project.",
"Miscellaneous",
),
]
2 changes: 1 addition & 1 deletion docker/oidc_op/scripts/make_test_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

_distroot = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../.."))

_root = 'test_site'
_root = "test_site"

if os.path.isdir(_root) is False:
os.makedirs(_root)
Expand Down
12 changes: 6 additions & 6 deletions docker/op_test/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
PORT_MIN = 60001
PORT_MAX = 61000

BASE_URL = 'https://op-test'
BASE_URL = "https://op-test"

# The variables below are all passed on to the test tool instance
ENT_PATH = 'entities'
ENT_INFO = 'entity_info'
ENT_PATH = "entities"
ENT_INFO = "entity_info"

FLOWDIR = 'flows'
FLOWDIR = "flows"

PATH2PORT = 'path2port.csv'
TEST_SCRIPT = './op_test_tool.py'
PATH2PORT = "path2port.csv"
TEST_SCRIPT = "./op_test_tool.py"
10 changes: 5 additions & 5 deletions docker/op_test/tt_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
VERIFY_SSL = False

# Make sure BASE starts with https if TLS = True
BASE = 'https://op-test'
BASE = "https://op-test"

ENT_PATH = 'entities'
ENT_INFO = 'entity_info'
PRE_HTML = 'html/tt'
ENT_PATH = "entities"
ENT_INFO = "entity_info"
PRE_HTML = "html/tt"

KEYS = [
{"key": "keys/enc.key", "type": "RSA", "use": ["enc"]},
{"key": "keys/sig.key", "type": "RSA", "use": ["sig"]},
{"crv": "P-256", "type": "EC", "use": ["sig"]},
{"crv": "P-256", "type": "EC", "use": ["enc"]}
{"crv": "P-256", "type": "EC", "use": ["enc"]},
]

SESSION_CHANGE_URL = "{}session_change"
Expand Down
49 changes: 27 additions & 22 deletions docker/rp_test/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{"type": "RSA", "key": "keys/pyoidc_enc", "use": ["enc"]},
{"type": "RSA", "key": "keys/pyoidc_sig", "use": ["sig"]},
{"type": "EC", "crv": "P-256", "use": ["sig"]},
{"type": "EC", "crv": "P-256", "use": ["enc"]}
{"type": "EC", "crv": "P-256", "use": ["enc"]},
]

multi_keys = [
Expand All @@ -17,36 +17,41 @@
{"type": "EC", "crv": "P-256", "use": ["sig"]},
{"type": "EC", "crv": "P-256", "use": ["enc"]},
{"type": "EC", "crv": "P-256", "use": ["sig"]},
{"type": "EC", "crv": "P-256", "use": ["enc"]}
{"type": "EC", "crv": "P-256", "use": ["enc"]},
]

FOS = ['https://swamid.sunet.se/oidc',
'https://surfnet.nl/oidc']
FOS = ["https://swamid.sunet.se/oidc", "https://surfnet.nl/oidc"]

KEYDEFS = [
{"type": "RSA", "key": '', "use": ["sig"]},
{"type": "EC", "crv": "P-256", "use": ["sig"]}
]
KEYDEFS = [{"type": "RSA", "key": "", "use": ["sig"]}, {"type": "EC", "crv": "P-256", "use": ["sig"]}]

GRPS = [
"Discovery", "Dynamic Client Registration",
"Response Type and Response Mode", "claims Request Parameter",
"request_uri Request Parameter", "scope Request Parameter",
"nonce Request Parameter", "Client Authentication",
"ID Token", "Key Rotation", "Claims Types", "UserInfo Endpoint",
"3rd-Party Init SSO", "RP Initiated BackChannel Logout",
"RP Initiated FrontChannel Logout", "RP Initiated Logout",
"Discovery",
"Dynamic Client Registration",
"Response Type and Response Mode",
"claims Request Parameter",
"request_uri Request Parameter",
"scope Request Parameter",
"nonce Request Parameter",
"Client Authentication",
"ID Token",
"Key Rotation",
"Claims Types",
"UserInfo Endpoint",
"3rd-Party Init SSO",
"RP Initiated BackChannel Logout",
"RP Initiated FrontChannel Logout",
"RP Initiated Logout",
]

#Only Username and password.
# Only Username and password.
AUTHENTICATION = {
#"UserPassword": {"ACR": "PASSWORD", "WEIGHT": 1, "URL": SERVICE_URL}
# "UserPassword": {"ACR": "PASSWORD", "WEIGHT": 1, "URL": SERVICE_URL}
"NoAuthn": {"ACR": "PASSWORD", "WEIGHT": 1, "user": "diana"}
}

COOKIE = {
'name': 'pyoic',
'ttl': 4 * 60 # 4 hours
"name": "pyoic",
"ttl": 4 * 60, # 4 hours
}
SYM_KEY = "SoLittleTime,Got"

Expand All @@ -56,7 +61,7 @@

CLIENT_DB = "client_db"

LOGOUT_PATH = 'logout'
LOGOUT_PATH = "logout"
CHECK_SESSION_IFRAME = "{}:{{}}/<PATH>/check_session_iframe".format(baseurl)

# ======= SIMPLE DATABASE ==============
Expand All @@ -77,7 +82,7 @@
"street_address": "Umeå Universitet",
"locality": "Umeå",
"postal_code": "SE-90187",
"country": "Sweden"
"country": "Sweden",
},
},
"babs": {
Expand All @@ -103,5 +108,5 @@
"family_name": "Crust",
"email": "uc@example.com",
"email_verified": True,
}
},
}
3 changes: 2 additions & 1 deletion oauth_example/as/as.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
A very simple OAuth2 AS
"""

import json
import logging
import os
Expand Down Expand Up @@ -257,7 +258,7 @@ def application(self, environ, start_response):
hostname=config.HOST,
capabilities=capabilities,
behavior=config.BEHAVIOR,
**kwargs
**kwargs,
)

try:
Expand Down
8 changes: 2 additions & 6 deletions oauth_example/as/authn_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,14 @@ def cas_setup(item):
_func = VALIDATOR[v_cnf["type"].upper()](item)

_cnf = item["config"]
return CasAuthnMethod(
None, _cnf["cas_server"], item["URL"], _cnf["return_to"], _func
)
return CasAuthnMethod(None, _cnf["cas_server"], item["URL"], _cnf["return_to"], _func)


def userpwd_setup(item):
from oic.utils.authn.user import UsernamePasswordMako

_conf = item["config"]
return UsernamePasswordMako(
None, "login.mako", _conf["lookup"], _conf["passwd"], _conf["return_to"]
)
return UsernamePasswordMako(None, "login.mako", _conf["lookup"], _conf["passwd"], _conf["return_to"])


AUTH_METHOD = {
Expand Down
4 changes: 1 addition & 3 deletions oauth_example/rp/rp.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@


def as_choice(environ, start_response):
resp = Response(
mako_template="as_choice.mako", template_lookup=RP_CONF.LOOKUP, headers=[]
)
resp = Response(mako_template="as_choice.mako", template_lookup=RP_CONF.LOOKUP, headers=[])
argv = {"as_list": RP_CONF.AS_CONF.keys(), "action": "as", "method": "POST"}
return resp(environ, start_response, **argv)

Expand Down
Loading

0 comments on commit 0bd1ead

Please sign in to comment.