ark-oauth-client 2.0.4__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.
Files changed (51) hide show
  1. ark_oauth_client-2.0.4/.gitignore +14 -0
  2. ark_oauth_client-2.0.4/CHANGELOG.md +39 -0
  3. ark_oauth_client-2.0.4/LICENSE +21 -0
  4. ark_oauth_client-2.0.4/PKG-INFO +615 -0
  5. ark_oauth_client-2.0.4/README.md +574 -0
  6. ark_oauth_client-2.0.4/examples/account_switch.py +87 -0
  7. ark_oauth_client-2.0.4/examples/api_server.py +57 -0
  8. ark_oauth_client-2.0.4/examples/client_credentials.py +39 -0
  9. ark_oauth_client-2.0.4/examples/config.py +35 -0
  10. ark_oauth_client-2.0.4/examples/device_flow.py +39 -0
  11. ark_oauth_client-2.0.4/examples/setup_check.py +61 -0
  12. ark_oauth_client-2.0.4/examples/web_app.py +70 -0
  13. ark_oauth_client-2.0.4/pyproject.toml +90 -0
  14. ark_oauth_client-2.0.4/src/ark_oauth_client/__init__.py +180 -0
  15. ark_oauth_client-2.0.4/src/ark_oauth_client/access/__init__.py +39 -0
  16. ark_oauth_client-2.0.4/src/ark_oauth_client/access/denied_page.py +102 -0
  17. ark_oauth_client-2.0.4/src/ark_oauth_client/access/endpoints.py +82 -0
  18. ark_oauth_client-2.0.4/src/ark_oauth_client/access/gate.py +111 -0
  19. ark_oauth_client-2.0.4/src/ark_oauth_client/access/options.py +273 -0
  20. ark_oauth_client-2.0.4/src/ark_oauth_client/access/state.py +103 -0
  21. ark_oauth_client-2.0.4/src/ark_oauth_client/auth_config.py +223 -0
  22. ark_oauth_client-2.0.4/src/ark_oauth_client/client.py +961 -0
  23. ark_oauth_client-2.0.4/src/ark_oauth_client/config.py +236 -0
  24. ark_oauth_client-2.0.4/src/ark_oauth_client/context.py +87 -0
  25. ark_oauth_client-2.0.4/src/ark_oauth_client/crypto.py +81 -0
  26. ark_oauth_client-2.0.4/src/ark_oauth_client/diagnostics.py +67 -0
  27. ark_oauth_client-2.0.4/src/ark_oauth_client/discovery.py +141 -0
  28. ark_oauth_client-2.0.4/src/ark_oauth_client/errors.py +112 -0
  29. ark_oauth_client-2.0.4/src/ark_oauth_client/flask.py +1297 -0
  30. ark_oauth_client-2.0.4/src/ark_oauth_client/flows/__init__.py +17 -0
  31. ark_oauth_client-2.0.4/src/ark_oauth_client/flows/client_credentials.py +219 -0
  32. ark_oauth_client-2.0.4/src/ark_oauth_client/flows/registration.py +196 -0
  33. ark_oauth_client-2.0.4/src/ark_oauth_client/helper.py +114 -0
  34. ark_oauth_client-2.0.4/src/ark_oauth_client/http.py +196 -0
  35. ark_oauth_client-2.0.4/src/ark_oauth_client/jwks.py +142 -0
  36. ark_oauth_client-2.0.4/src/ark_oauth_client/jwt.py +487 -0
  37. ark_oauth_client-2.0.4/src/ark_oauth_client/pkce.py +58 -0
  38. ark_oauth_client-2.0.4/src/ark_oauth_client/probe.py +345 -0
  39. ark_oauth_client-2.0.4/src/ark_oauth_client/py.typed +0 -0
  40. ark_oauth_client-2.0.4/src/ark_oauth_client/session.py +142 -0
  41. ark_oauth_client-2.0.4/src/ark_oauth_client/tokens.py +157 -0
  42. ark_oauth_client-2.0.4/tests/__init__.py +0 -0
  43. ark_oauth_client-2.0.4/tests/conftest.py +27 -0
  44. ark_oauth_client-2.0.4/tests/stub_idp.py +534 -0
  45. ark_oauth_client-2.0.4/tests/test_client.py +447 -0
  46. ark_oauth_client-2.0.4/tests/test_config.py +179 -0
  47. ark_oauth_client-2.0.4/tests/test_flask.py +602 -0
  48. ark_oauth_client-2.0.4/tests/test_flows.py +213 -0
  49. ark_oauth_client-2.0.4/tests/test_jwks.py +84 -0
  50. ark_oauth_client-2.0.4/tests/test_jwt.py +192 -0
  51. ark_oauth_client-2.0.4/tests/test_pkce.py +129 -0
@@ -0,0 +1,14 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .eggs/
5
+ build/
6
+ dist/
7
+ .venv/
8
+ venv/
9
+ .pytest_cache/
10
+ .mypy_cache/
11
+ .ruff_cache/
12
+ .coverage
13
+ htmlcov/
14
+ .DS_Store
@@ -0,0 +1,39 @@
1
+ # Changelog
2
+
3
+ ## 2.0.4
4
+
5
+ First release of the Python client, published alongside `Ark.oAuth.Client` 2.0.4 and
6
+ `ark-oauth-client` 2.0.1 for Node so the three halves carry the same version.
7
+
8
+ Feature parity with the .NET package:
9
+
10
+ * `add_ark_oidc_client(app, config)` — interactive sign-in for Flask. Authorization code + PKCE
11
+ against the provider's discovery document: real `state` and `nonce` validation, JWKS rollover,
12
+ silent refresh, and RP-initiated logout that revokes the refresh-token family first.
13
+ * `add_ark_oidc_api(app, prefix, …)` — bearer-token protection for an API, verified locally against
14
+ the cached JWKS.
15
+ * Account switching on a shared browser, in full: `account_switch.require_ark_claims` moves the
16
+ entitlement check to the callback so no session is written for an account that cannot use the
17
+ application; the built-in access-denied page at `/ark/no-access` names the account and offers
18
+ "Sign in as a different user" with `prompt=login`; `ark_switch_user()`,
19
+ `ark_sign_out_everywhere()`, `ark_sign_out_locally()` and `ark_denied_account()`; and the
20
+ `on_evaluate_access` / `on_access_denied` events for a rule or a page of your own. Every part is
21
+ off or unchanged by default.
22
+ * The three non-browser services: `ArkSetupProbe` (configuration against live metadata),
23
+ `ArkClientCredentials` (with caching and a redacted request form) and `ArkRegistration`
24
+ (RFC 7591/7592).
25
+ * `ArkOAuthClient` — the whole protocol on its own, for CLIs, workers, Django and FastAPI. Adds the
26
+ device grant (RFC 8628), pushed authorization requests (RFC 9126), introspection, revocation and
27
+ `private_key_jwt` client authentication over what the .NET package exposes.
28
+ * `ArkAuthConfig.from_mapping` binds an existing `appsettings.json` unchanged, in either the C# or
29
+ the Python spelling of every key.
30
+ * `ArkAuthContext`, `AUserInfo`, `AUser`, `AuthClientHelper`, `ArkJwt`, `ArkJson` and `PkceHelper`
31
+ carry their .NET names.
32
+
33
+ Not carried over: the legacy cookie/bearer middleware. `use_legacy_flow` is accepted for
34
+ configuration parity, but the flow itself never validated `state` or `nonce` and derived its PKCE
35
+ verifier from a timestamp; it was a migration aid in the .NET package, not a supported
36
+ configuration, and there is nothing in Python to migrate from.
37
+
38
+ Requires Python 3.9+. One runtime dependency, `cryptography`, for signature verification; Flask is
39
+ an optional extra.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Immanuel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.