py-oidc-auth-client 2602.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- py_oidc_auth_client-2602.0.0/.github/workflows/build_job.yml +44 -0
- py_oidc_auth_client-2602.0.0/.github/workflows/ci_job.yml +79 -0
- py_oidc_auth_client-2602.0.0/.gitignore +208 -0
- py_oidc_auth_client-2602.0.0/.readthedocs.yaml +24 -0
- py_oidc_auth_client-2602.0.0/LICENSE +28 -0
- py_oidc_auth_client-2602.0.0/PKG-INFO +213 -0
- py_oidc_auth_client-2602.0.0/README.md +162 -0
- py_oidc_auth_client-2602.0.0/docs/Makefile +20 -0
- py_oidc_auth_client-2602.0.0/docs/make.bat +35 -0
- py_oidc_auth_client-2602.0.0/docs/requirements.txt +1 -0
- py_oidc_auth_client-2602.0.0/docs/source/_static/favicon.ico +0 -0
- py_oidc_auth_client-2602.0.0/docs/source/_static/favicon.png +0 -0
- py_oidc_auth_client-2602.0.0/docs/source/_static/logo.png +0 -0
- py_oidc_auth_client-2602.0.0/docs/source/api/exceptions.rst +4 -0
- py_oidc_auth_client-2602.0.0/docs/source/api/flows.rst +4 -0
- py_oidc_auth_client-2602.0.0/docs/source/api/index.rst +11 -0
- py_oidc_auth_client-2602.0.0/docs/source/api/public.rst +9 -0
- py_oidc_auth_client-2602.0.0/docs/source/api/schema.rst +4 -0
- py_oidc_auth_client-2602.0.0/docs/source/api/utils.rst +4 -0
- py_oidc_auth_client-2602.0.0/docs/source/code-of-conduct.rst +17 -0
- py_oidc_auth_client-2602.0.0/docs/source/conf.py +155 -0
- py_oidc_auth_client-2602.0.0/docs/source/guides/configuration.rst +57 -0
- py_oidc_auth_client-2602.0.0/docs/source/guides/non_interactive.rst +41 -0
- py_oidc_auth_client-2602.0.0/docs/source/guides/overview.rst +26 -0
- py_oidc_auth_client-2602.0.0/docs/source/guides/quickstart.rst +41 -0
- py_oidc_auth_client-2602.0.0/docs/source/index.rst +67 -0
- py_oidc_auth_client-2602.0.0/docs/source/whatsnew.rst +8 -0
- py_oidc_auth_client-2602.0.0/pyproject.toml +169 -0
- py_oidc_auth_client-2602.0.0/src/py_oidc_auth_client/__init__.py +323 -0
- py_oidc_auth_client-2602.0.0/src/py_oidc_auth_client/__main__.py +198 -0
- py_oidc_auth_client-2602.0.0/src/py_oidc_auth_client/exceptions.py +64 -0
- py_oidc_auth_client-2602.0.0/src/py_oidc_auth_client/flows.py +956 -0
- py_oidc_auth_client-2602.0.0/src/py_oidc_auth_client/schema.py +105 -0
- py_oidc_auth_client-2602.0.0/src/py_oidc_auth_client/token_store.py +353 -0
- py_oidc_auth_client-2602.0.0/src/py_oidc_auth_client/utils.py +279 -0
- py_oidc_auth_client-2602.0.0/tests/__init__.py +0 -0
- py_oidc_auth_client-2602.0.0/tests/conftest.py +355 -0
- py_oidc_auth_client-2602.0.0/tests/files.zip +0 -0
- py_oidc_auth_client-2602.0.0/tests/test_authenticate.py +138 -0
- py_oidc_auth_client-2602.0.0/tests/test_cli.py +150 -0
- py_oidc_auth_client-2602.0.0/tests/test_exceptions.py +35 -0
- py_oidc_auth_client-2602.0.0/tests/test_flows.py +629 -0
- py_oidc_auth_client-2602.0.0/tests/test_token_store.py +216 -0
- py_oidc_auth_client-2602.0.0/tests/test_utils.py +184 -0
- py_oidc_auth_client-2602.0.0/tests/utils.py +279 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Build and publish to PyPI
|
|
2
|
+
run-name: ${{ github.actor }} is preparing the next release
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
tags:
|
|
7
|
+
- "v*.*.*"
|
|
8
|
+
workflow_dispatch: {}
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
pypi:
|
|
12
|
+
name: Create Pip package
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
environment: pypi
|
|
15
|
+
permissions:
|
|
16
|
+
id-token: write
|
|
17
|
+
contents: read
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
-
|
|
21
|
+
name: Checkout
|
|
22
|
+
uses: actions/checkout@v4
|
|
23
|
+
with:
|
|
24
|
+
submodules: recursive
|
|
25
|
+
-
|
|
26
|
+
name: Setup Python
|
|
27
|
+
uses: actions/setup-python@v4
|
|
28
|
+
with:
|
|
29
|
+
python-version: "3.x"
|
|
30
|
+
-
|
|
31
|
+
name: Install flit
|
|
32
|
+
run: python -m pip install flit
|
|
33
|
+
-
|
|
34
|
+
name: Building package 📦 with flit
|
|
35
|
+
run: flit build
|
|
36
|
+
|
|
37
|
+
- name: Publish to PyPI
|
|
38
|
+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
|
|
39
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
40
|
+
with:
|
|
41
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
42
|
+
skip-existing: true
|
|
43
|
+
verbose: true
|
|
44
|
+
packages-dir: dist
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
name: CI Tests
|
|
2
|
+
|
|
3
|
+
permissions:
|
|
4
|
+
pull-requests: write
|
|
5
|
+
contents: write
|
|
6
|
+
packages: write
|
|
7
|
+
|
|
8
|
+
on: [push, pull_request, workflow_call]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
lint-and-docs:
|
|
12
|
+
name: Linting
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
with:
|
|
18
|
+
submodules: recursive
|
|
19
|
+
- name: Setup Python ${{ matrix.python-version }}
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.13"
|
|
23
|
+
- name: Install packages
|
|
24
|
+
run: |
|
|
25
|
+
python3 -m pip install tox flit
|
|
26
|
+
- name: Linting, type checking and docs with tox
|
|
27
|
+
run: tox -p 3 --parallel-no-spinner
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
tests:
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
strategy:
|
|
34
|
+
max-parallel: 5
|
|
35
|
+
matrix:
|
|
36
|
+
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]
|
|
37
|
+
steps:
|
|
38
|
+
- name: Checkout
|
|
39
|
+
uses: actions/checkout@v4
|
|
40
|
+
with:
|
|
41
|
+
lfs: false
|
|
42
|
+
submodules: recursive
|
|
43
|
+
fetch-depth: 0
|
|
44
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
45
|
+
uses: actions/setup-python@v5
|
|
46
|
+
with:
|
|
47
|
+
python-version: ${{matrix.python-version}}
|
|
48
|
+
- name: Install dependencies
|
|
49
|
+
run: |
|
|
50
|
+
python3 -m pip install tox
|
|
51
|
+
- name: Run tests
|
|
52
|
+
run: tox -e test
|
|
53
|
+
- name: Upload coverage to Codecov
|
|
54
|
+
uses: codecov/codecov-action@v4
|
|
55
|
+
with:
|
|
56
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
57
|
+
verbose: true
|
|
58
|
+
|
|
59
|
+
dependabot:
|
|
60
|
+
name: Merge PR by dependabot
|
|
61
|
+
runs-on: ubuntu-latest
|
|
62
|
+
needs: [tests, lint-and-docs]
|
|
63
|
+
if: github.event.pull_request.user.login == 'dependabot[bot]'
|
|
64
|
+
steps:
|
|
65
|
+
- name: Dependabot metadata
|
|
66
|
+
id: metadata
|
|
67
|
+
uses: dependabot/fetch-metadata@v1
|
|
68
|
+
with:
|
|
69
|
+
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
|
70
|
+
- name: Approve dependabot's PR
|
|
71
|
+
run: gh pr review --approve "$PR_URL"
|
|
72
|
+
env:
|
|
73
|
+
PR_URL: ${{github.event.pull_request.html_url}}
|
|
74
|
+
GITHUB_TOKEN: ${{secrets.TOKEN}}
|
|
75
|
+
- name: Auto-merge for dependabot's PR
|
|
76
|
+
run: gh pr merge --merge --auto "$PR_URL"
|
|
77
|
+
env:
|
|
78
|
+
PR_URL: ${{github.event.pull_request.html_url}}
|
|
79
|
+
GITHUB_TOKEN: ${{secrets.TOKEN}}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
report.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py.cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
cover/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
#Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# UV
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
#uv.lock
|
|
103
|
+
|
|
104
|
+
# poetry
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
106
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
107
|
+
# commonly ignored for libraries.
|
|
108
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
109
|
+
#poetry.lock
|
|
110
|
+
#poetry.toml
|
|
111
|
+
|
|
112
|
+
# pdm
|
|
113
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
114
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
115
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
116
|
+
#pdm.lock
|
|
117
|
+
#pdm.toml
|
|
118
|
+
.pdm-python
|
|
119
|
+
.pdm-build/
|
|
120
|
+
|
|
121
|
+
# pixi
|
|
122
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
123
|
+
#pixi.lock
|
|
124
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
125
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
126
|
+
.pixi
|
|
127
|
+
|
|
128
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
129
|
+
__pypackages__/
|
|
130
|
+
|
|
131
|
+
# Celery stuff
|
|
132
|
+
celerybeat-schedule
|
|
133
|
+
celerybeat.pid
|
|
134
|
+
|
|
135
|
+
# SageMath parsed files
|
|
136
|
+
*.sage.py
|
|
137
|
+
|
|
138
|
+
# Environments
|
|
139
|
+
.env
|
|
140
|
+
.envrc
|
|
141
|
+
.venv
|
|
142
|
+
env/
|
|
143
|
+
venv/
|
|
144
|
+
ENV/
|
|
145
|
+
env.bak/
|
|
146
|
+
venv.bak/
|
|
147
|
+
|
|
148
|
+
# Spyder project settings
|
|
149
|
+
.spyderproject
|
|
150
|
+
.spyproject
|
|
151
|
+
|
|
152
|
+
# Rope project settings
|
|
153
|
+
.ropeproject
|
|
154
|
+
|
|
155
|
+
# mkdocs documentation
|
|
156
|
+
/site
|
|
157
|
+
|
|
158
|
+
# mypy
|
|
159
|
+
.mypy_cache/
|
|
160
|
+
.dmypy.json
|
|
161
|
+
dmypy.json
|
|
162
|
+
|
|
163
|
+
# Pyre type checker
|
|
164
|
+
.pyre/
|
|
165
|
+
|
|
166
|
+
# pytype static type analyzer
|
|
167
|
+
.pytype/
|
|
168
|
+
|
|
169
|
+
# Cython debug symbols
|
|
170
|
+
cython_debug/
|
|
171
|
+
|
|
172
|
+
# PyCharm
|
|
173
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
174
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
175
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
176
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
177
|
+
#.idea/
|
|
178
|
+
|
|
179
|
+
# Abstra
|
|
180
|
+
# Abstra is an AI-powered process automation framework.
|
|
181
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
182
|
+
# Learn more at https://abstra.io/docs
|
|
183
|
+
.abstra/
|
|
184
|
+
|
|
185
|
+
# Visual Studio Code
|
|
186
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
187
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
188
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
189
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
190
|
+
# .vscode/
|
|
191
|
+
|
|
192
|
+
# Ruff stuff:
|
|
193
|
+
.ruff_cache/
|
|
194
|
+
|
|
195
|
+
# PyPI configuration file
|
|
196
|
+
.pypirc
|
|
197
|
+
|
|
198
|
+
# Cursor
|
|
199
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
200
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
201
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
202
|
+
.cursorignore
|
|
203
|
+
.cursorindexingignore
|
|
204
|
+
|
|
205
|
+
# Marimo
|
|
206
|
+
marimo/_static/
|
|
207
|
+
marimo/_lsp/
|
|
208
|
+
__marimo__/
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
# Read the Docs configuration file
|
|
4
|
+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
|
5
|
+
|
|
6
|
+
# Required
|
|
7
|
+
version: 2
|
|
8
|
+
|
|
9
|
+
# Set the OS, Python version, and other tools you might need
|
|
10
|
+
build:
|
|
11
|
+
os: ubuntu-24.04
|
|
12
|
+
tools:
|
|
13
|
+
python: "3.13"
|
|
14
|
+
|
|
15
|
+
# Build documentation in the "docs/" directory with Sphinx
|
|
16
|
+
sphinx:
|
|
17
|
+
configuration: docs/source/conf.py
|
|
18
|
+
|
|
19
|
+
# Optionally, but recommended,
|
|
20
|
+
# declare the Python requirements required to build your documentation
|
|
21
|
+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
|
|
22
|
+
python:
|
|
23
|
+
install:
|
|
24
|
+
- requirements: docs/requirements.txt
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Freva
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py-oidc-auth-client
|
|
3
|
+
Version: 2602.0.0
|
|
4
|
+
Summary: Client library for the OIDC Auth server.
|
|
5
|
+
Author-email: "DKRZ, Clint" <freva@dkrz.de>
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
11
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: httpx
|
|
15
|
+
Requires-Dist: platformdirs
|
|
16
|
+
Requires-Dist: rich
|
|
17
|
+
Requires-Dist: typing_extensions
|
|
18
|
+
Requires-Dist: rich-argparse ; extra == "cli"
|
|
19
|
+
Requires-Dist: tox ; extra == "dev"
|
|
20
|
+
Requires-Dist: cryptography ; extra == "dev"
|
|
21
|
+
Requires-Dist: uvicorn ; extra == "dev"
|
|
22
|
+
Requires-Dist: py-oidc-auth[fastapi, tests] ; extra == "dev"
|
|
23
|
+
Requires-Dist: sphinx-execute-code-python3 ; extra == "docs"
|
|
24
|
+
Requires-Dist: sphinx-code-tabs ; extra == "docs"
|
|
25
|
+
Requires-Dist: sphinx-copybutton ; extra == "docs"
|
|
26
|
+
Requires-Dist: sphinx-sitemap ; extra == "docs"
|
|
27
|
+
Requires-Dist: sphinx-togglebutton ; extra == "docs"
|
|
28
|
+
Requires-Dist: sphinxcontrib-httpdomain ; extra == "docs"
|
|
29
|
+
Requires-Dist: sphinxext-opengraph ; extra == "docs"
|
|
30
|
+
Requires-Dist: sphinx-design ; extra == "docs"
|
|
31
|
+
Requires-Dist: pydata-sphinx-theme ; extra == "docs"
|
|
32
|
+
Requires-Dist: pytest ; extra == "tests"
|
|
33
|
+
Requires-Dist: pytest-env ; extra == "tests"
|
|
34
|
+
Requires-Dist: mock ; extra == "tests"
|
|
35
|
+
Requires-Dist: pytest-mock ; extra == "tests"
|
|
36
|
+
Requires-Dist: pytest-cov ; extra == "tests"
|
|
37
|
+
Requires-Dist: pytest-asyncio ; extra == "tests"
|
|
38
|
+
Requires-Dist: requests ; extra == "tests"
|
|
39
|
+
Requires-Dist: uvicorn ; extra == "tests"
|
|
40
|
+
Requires-Dist: fastapi ; extra == "tests"
|
|
41
|
+
Requires-Dist: python-multipart ; extra == "tests"
|
|
42
|
+
Requires-Dist: PyJWT[crypto] ; extra == "tests"
|
|
43
|
+
Project-URL: Documentation, https://py-oidc-auth-client.readthedocs.io
|
|
44
|
+
Project-URL: Issues, https://github.com/freva-org/py-oidc-auth-client/issues
|
|
45
|
+
Project-URL: Source, https://github.com/freva-org/py-oidc-auth-client/
|
|
46
|
+
Provides-Extra: cli
|
|
47
|
+
Provides-Extra: dev
|
|
48
|
+
Provides-Extra: docs
|
|
49
|
+
Provides-Extra: tests
|
|
50
|
+
|
|
51
|
+
<p align="center">
|
|
52
|
+
<img src="docs/source/_static/logo.png" alt="py-oidc-auth-client logo" width="560">
|
|
53
|
+
</p>
|
|
54
|
+
<p align="center">
|
|
55
|
+
<em>Typed client library for the authentication routes exposed by py-oidc-auth.</em>
|
|
56
|
+
</p>
|
|
57
|
+
|
|
58
|
+
[](LICENSE)
|
|
59
|
+
[](https://codecov.io/gh/freva-org/py-oidc-auth-client)
|
|
60
|
+
[](https://py-oidc-auth-client.readthedocs.io/en/latest/?badge=latest)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
py-oidc-auth-client is the counterpart of the server-side library **py-oidc-auth**.
|
|
65
|
+
|
|
66
|
+
While **py-oidc-auth** helps you add OpenID Connect login, token, and device endpoints to web frameworks,
|
|
67
|
+
**py-oidc-auth-client** consumes those routes and gives you ready-to-use bearer tokens for calling protected APIs.
|
|
68
|
+
|
|
69
|
+
## Features
|
|
70
|
+
|
|
71
|
+
* One high level helper: `authenticate()`
|
|
72
|
+
* Device flow for headless sessions
|
|
73
|
+
* Authorization code flow for interactive logins
|
|
74
|
+
* Token caching and refresh token support via a token file
|
|
75
|
+
* Fully typed public API
|
|
76
|
+
|
|
77
|
+
## Install
|
|
78
|
+
|
|
79
|
+
```console
|
|
80
|
+
python -m pip install py-oidc-auth-client
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Import name is `py_oidc_auth_client`:
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from py_oidc_auth_client import authenticate
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Relationship to py-oidc-auth
|
|
90
|
+
|
|
91
|
+
A typical **py-oidc-auth** server exposes endpoints similar to:
|
|
92
|
+
|
|
93
|
+
* `GET /auth/v2/login`
|
|
94
|
+
* `GET /auth/v2/callback`
|
|
95
|
+
* `POST /auth/v2/token`
|
|
96
|
+
* `POST /auth/v2/device`
|
|
97
|
+
* `GET /auth/v2/logout`
|
|
98
|
+
* `GET /auth/v2/userinfo`
|
|
99
|
+
|
|
100
|
+
This client calls the relevant routes (token and device, and possibly login/callback) and returns a `Token`
|
|
101
|
+
object that contains a ready-made `Authorization` header.
|
|
102
|
+
|
|
103
|
+
## Quick start
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
from py_oidc_auth_client import authenticate
|
|
107
|
+
|
|
108
|
+
token = authenticate(host="https://auth.example.org")
|
|
109
|
+
|
|
110
|
+
# Use with any HTTP client
|
|
111
|
+
headers = token["headers"]
|
|
112
|
+
print(headers["Authorization"])
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Use with httpx
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
import httpx
|
|
119
|
+
from py_oidc_auth_client import authenticate
|
|
120
|
+
|
|
121
|
+
token = authenticate(host="https://auth.example.org")
|
|
122
|
+
|
|
123
|
+
with httpx.Client() as client:
|
|
124
|
+
r = client.get("https://service.example.org/protected", headers=token["headers"])
|
|
125
|
+
r.raise_for_status()
|
|
126
|
+
print(r.json())
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Token persistence
|
|
130
|
+
|
|
131
|
+
By default, the client stores tokens in a cache file so you do not have to re-authenticate on every run.
|
|
132
|
+
You can control where tokens are stored with `token_file`:
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from py_oidc_auth_client import authenticate
|
|
136
|
+
|
|
137
|
+
token = authenticate(
|
|
138
|
+
host="https://auth.example.org",
|
|
139
|
+
token_file="~/.cache/py-oidc-auth-client/token.json",
|
|
140
|
+
)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
You can also point to a token file via environment variable:
|
|
144
|
+
|
|
145
|
+
* `OIDC_TOKEN_FILE`
|
|
146
|
+
|
|
147
|
+
## Interactive and non-interactive environments
|
|
148
|
+
|
|
149
|
+
The client tries to select a suitable strategy:
|
|
150
|
+
|
|
151
|
+
1. Use a valid cached access token.
|
|
152
|
+
2. Refresh using the refresh token.
|
|
153
|
+
3. If interactive authentication is possible, fall back to an interactive login.
|
|
154
|
+
4. If running in a non-interactive session without a usable token, raise an error telling you how to provide a token file.
|
|
155
|
+
|
|
156
|
+
For headless sessions, the device flow is the recommended approach.
|
|
157
|
+
|
|
158
|
+
## Advanced usage
|
|
159
|
+
|
|
160
|
+
If you need more control than `authenticate()`, use the flow helpers from `py_oidc_auth_client.auth`.
|
|
161
|
+
|
|
162
|
+
### Device flow
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
import asyncio
|
|
166
|
+
from py_oidc_auth_client.auth import DeviceFlowResponse
|
|
167
|
+
from py_oidc_auth_client.utils import Config
|
|
168
|
+
|
|
169
|
+
async def main() -> None:
|
|
170
|
+
cfg = Config(host="https://auth.example.org")
|
|
171
|
+
flow = DeviceFlowResponse(config=cfg, token=None, timeout=600)
|
|
172
|
+
|
|
173
|
+
device = await flow.get_device_code()
|
|
174
|
+
print("Open:", device.uri)
|
|
175
|
+
print("Code:", device.user_code)
|
|
176
|
+
|
|
177
|
+
await flow.poll_for_token(device.device_code, int(device.interval))
|
|
178
|
+
print(flow.token["headers"])
|
|
179
|
+
|
|
180
|
+
asyncio.run(main())
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Authorization code flow
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
import asyncio
|
|
187
|
+
from py_oidc_auth_client.auth import CodeFlowResponse
|
|
188
|
+
from py_oidc_auth_client.utils import Config
|
|
189
|
+
|
|
190
|
+
async def main() -> None:
|
|
191
|
+
cfg = Config(host="https://auth.example.org")
|
|
192
|
+
flow = CodeFlowResponse(config=cfg, token=None, timeout=120)
|
|
193
|
+
await flow.login()
|
|
194
|
+
print(flow.token["headers"])
|
|
195
|
+
|
|
196
|
+
asyncio.run(main())
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Documentation
|
|
200
|
+
|
|
201
|
+
This repository ships a Sphinx documentation tree under `docs/`.
|
|
202
|
+
|
|
203
|
+
If you build documentation without installing all runtime dependencies, you can configure Sphinx to mock
|
|
204
|
+
imports via `autodoc_mock_imports` in `conf.py`.
|
|
205
|
+
|
|
206
|
+
## License
|
|
207
|
+
|
|
208
|
+
Choose a license that matches your project goals. For most Python libraries, MIT or Apache-2.0 are common choices.
|
|
209
|
+
|
|
210
|
+
## Contributing
|
|
211
|
+
|
|
212
|
+
Contributions are welcome. Please open an issue to discuss larger changes before submitting a pull request.
|
|
213
|
+
|