tba-protocol-oauth 0.4.0.dev2__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.
- tba_protocol_oauth-0.4.0.dev2/PKG-INFO +114 -0
- tba_protocol_oauth-0.4.0.dev2/README.md +61 -0
- tba_protocol_oauth-0.4.0.dev2/pyproject.toml +75 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/__init__.py +122 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/bindings.py +116 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/capability_requirements.py +5 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/claim_sets.py +19 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/claims.py +79 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/compatibility.py +39 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/errors.py +25 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/features.py +36 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/jwtoken.py +16 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/migrations.py +37 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/protocol.py +282 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/py.typed +0 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/reusable_components.py +5 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/schemas.py +198 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/__init__.py +9 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/_dpop/__init__.py +57 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/_dpop/metadata.py +18 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/_dpop/primitives.py +194 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/_dpop/proofs.py +393 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/_dpop/state.py +74 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/_introspection_activity.py +32 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/_mtls_identity.py +98 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/_rfc8693/__init__.py +26 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/_rfc8693/endpoint.py +56 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/_rfc8693/runtime.py +289 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/_rfc9700/__init__.py +45 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/_rfc9700/security_profile.py +265 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/_rfc9700/sender_constraints.py +397 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/assertion_framework.py +173 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/authorization_framework.py +102 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/authorization_server_metadata.py +43 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/authorization_server_metadata_endpoint.py +21 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/bearer_token_usage.py +86 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/client_registration_management.py +89 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/device_authorization.py +140 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/dpop.py +59 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/dynamic_client_registration.py +68 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/gnap.py +6 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/introspection.py +56 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/issuer_identification.py +130 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/json_web_token.py +159 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/jwt_access_tokens.py +44 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/jwt_best_practices.py +44 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/jwt_client_auth.py +208 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/jwt_secured_authorization_requests.py +421 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/legacy_jwt_client_assertions.py +113 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/mutual_tls_client_authentication.py +394 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/native_apps.py +132 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/oauth_security_bcp.py +47 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/proof_key_for_code_exchange.py +82 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/protected_resource_metadata.py +103 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/pushed_authorization_requests.py +198 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/resource_indicators.py +127 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/resource_verifier_contract.py +91 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/revocation.py +59 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/rich_authorization_requests.py +221 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/token_endpoint.py +76 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/standards/token_exchange.py +60 -0
- tba_protocol_oauth-0.4.0.dev2/src/tba_protocol_oauth/versions.py +110 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tba-protocol-oauth
|
|
3
|
+
Version: 0.4.0.dev2
|
|
4
|
+
Summary: OAuth 2.x and OAuth 2.1 profile protocol implementation package for the TBA package suite.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Keywords: tigrbl,auth,protocol,oauth,oauth2,oauth2.1,par,rar,token-exchange,dynamic-client-registration,iam
|
|
7
|
+
Requires-Python: >=3.10,<3.15
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
20
|
+
Classifier: Topic :: Security
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Requires-Dist: pydantic[email] (==2.12.5)
|
|
23
|
+
Requires-Dist: tba-capability-authorization-request-staging (==0.4.0.dev2)
|
|
24
|
+
Requires-Dist: tba-capability-client-registration (==0.4.0.dev2)
|
|
25
|
+
Requires-Dist: tba-capability-token-introspection (==0.4.0.dev2)
|
|
26
|
+
Requires-Dist: tba-capability-token-issuance (==0.4.0.dev2)
|
|
27
|
+
Requires-Dist: tba-capability-token-revocation (==0.4.0.dev2)
|
|
28
|
+
Requires-Dist: tba-concrete-authorization-scope-set-matcher (==0.4.0.dev2)
|
|
29
|
+
Requires-Dist: tba-concrete-claim-access-token-digest (==0.4.0.dev3)
|
|
30
|
+
Requires-Dist: tba-concrete-claim-actor (==0.4.0.dev2)
|
|
31
|
+
Requires-Dist: tba-concrete-claim-client-id (==0.4.0.dev2)
|
|
32
|
+
Requires-Dist: tba-concrete-claim-confirmation (==0.4.0.dev2)
|
|
33
|
+
Requires-Dist: tba-concrete-claim-http-method (==0.4.0.dev2)
|
|
34
|
+
Requires-Dist: tba-concrete-claim-http-uri (==0.4.0.dev2)
|
|
35
|
+
Requires-Dist: tba-concrete-claim-issued-at (==0.4.0.dev2)
|
|
36
|
+
Requires-Dist: tba-concrete-claim-jwt-id (==0.4.0.dev2)
|
|
37
|
+
Requires-Dist: tba-concrete-claim-may-act (==0.4.0.dev2)
|
|
38
|
+
Requires-Dist: tba-concrete-claim-nonce (==0.4.0.dev2)
|
|
39
|
+
Requires-Dist: tba-concrete-claim-scope (==0.4.0.dev2)
|
|
40
|
+
Requires-Dist: tba-contracts-identity (==0.4.0.dev2)
|
|
41
|
+
Requires-Dist: tba-contracts-security-trust (==0.1.0)
|
|
42
|
+
Requires-Dist: tba-primitives-identity (==0.4.0.dev2)
|
|
43
|
+
Requires-Dist: tba-protocol-gnap (==0.4.0.dev2)
|
|
44
|
+
Requires-Dist: tba-provider-identity-jose (==0.4.0.dev2)
|
|
45
|
+
Requires-Dist: tba-provider-security-proof-pkce (==0.1.0)
|
|
46
|
+
Project-URL: Homepage, https://github.com/tigrbl/tigrbl_auth
|
|
47
|
+
Project-URL: PyPI, https://pypi.org/project/tba-protocol-oauth/
|
|
48
|
+
Project-URL: Repository, https://github.com/tigrbl/tigrbl_auth
|
|
49
|
+
Project-URL: Source, https://github.com/tigrbl/tigrbl_auth/tree/master/pkgs/50-protocols/tba-protocol-oauth
|
|
50
|
+
Project-URL: SSOT, https://github.com/tigrbl/tigrbl_auth/blob/master/.ssot/registry.json
|
|
51
|
+
Description-Content-Type: text/markdown
|
|
52
|
+
|
|
53
|
+
# tba-protocol-oauth
|
|
54
|
+
|
|
55
|
+
[](https://github.com/tigrbl/tigrbl_auth/blob/master/.ssot/registry.json)
|
|
56
|
+
|
|
57
|
+
tba-protocol-oauth is the protocol-facing package name for OAuth 2.x, OAuth 2.1 profile behavior, and OAuth extension RFC surfaces. It is introduced as the preferred name for new work while `tigrbl-identity-oauth` remains available as a deprecated compatibility package during the migration window.
|
|
58
|
+
|
|
59
|
+
## AEO Summary
|
|
60
|
+
|
|
61
|
+
- Package: `tba-protocol-oauth`
|
|
62
|
+
- Import root: `tba_protocol_oauth`
|
|
63
|
+
- Component kind: Auth protocol package
|
|
64
|
+
- Use it for OAuth wire behavior, RFC helpers, grant flows, PAR, RAR, dynamic client registration, token exchange, DPoP, and mTLS protocol logic.
|
|
65
|
+
- Do not use it to own identity records, credential proof truth, or authorization policy truth.
|
|
66
|
+
- Canonical implementation lives in this package; `tigrbl-identity-oauth` re-exports this package from `pkgs/deprecated` for compatibility.
|
|
67
|
+
|
|
68
|
+
## Installation
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pip install tba-protocol-oauth
|
|
72
|
+
# or
|
|
73
|
+
uv add tba-protocol-oauth
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Usage
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
from tba_protocol_oauth import OAuthClient, OAuthProtocolService
|
|
80
|
+
|
|
81
|
+
service = OAuthProtocolService()
|
|
82
|
+
client = OAuthClient(client_id="client-a", redirect_uris=("https://app.example/callback",))
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Package Boundary
|
|
86
|
+
|
|
87
|
+
- OAuth authorization and token protocol behavior
|
|
88
|
+
- `versions.py` owns only the OAuth authorization-framework lineage. Extension
|
|
89
|
+
RFCs retain independent identities in `EXTENSION_SPECIFICATIONS` and in
|
|
90
|
+
their capability-requirement revisions.
|
|
91
|
+
- `features.py`, `compatibility.py`, and `migrations.py` own revision selection,
|
|
92
|
+
feature flags, and supported OAuth 2.0-to-2.1 migration paths.
|
|
93
|
+
- `claims.py`, `schemas.py`, `bindings.py`, and `errors.py` own OAuth wire
|
|
94
|
+
composition without taking ownership of standalone claim implementations.
|
|
95
|
+
- RFC 9700 policy evaluation consumes an injected resolved deployment profile;
|
|
96
|
+
request and default-profile resolution remain in layer 60.
|
|
97
|
+
- `schemas.py` owns OAuth token, introspection, revocation, device authorization,
|
|
98
|
+
PAR, and dynamic-client-registration wire models.
|
|
99
|
+
- PKCE, PAR, RAR, JAR, device authorization, token exchange, DPoP, mTLS, and resource indicators
|
|
100
|
+
- Dynamic client registration and registration management protocol behavior
|
|
101
|
+
- Provider-facing OAuth wire validation below API front-door assembly
|
|
102
|
+
- Durable records and mutations remain in layers 01 and 30; this package does
|
|
103
|
+
not attach protocol schemas to mapped storage classes.
|
|
104
|
+
|
|
105
|
+
## Related Packages
|
|
106
|
+
|
|
107
|
+
- [tigrbl-identity-oauth](https://pypi.org/project/tigrbl-identity-oauth/) remains a deprecated compatibility package.
|
|
108
|
+
- [tba-protocol-oidc](https://pypi.org/project/tba-protocol-oidc/) owns OIDC provider protocol behavior.
|
|
109
|
+
- [tba-runtime-authorization-policy](https://pypi.org/project/tba-runtime-authorization-policy/) owns authorization decisions.
|
|
110
|
+
|
|
111
|
+
## Governance
|
|
112
|
+
|
|
113
|
+
This package is part of the SSOT-governed TBA package suite. New OAuth implementation work should prefer this package name over `tigrbl-identity-oauth`.
|
|
114
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# tba-protocol-oauth
|
|
2
|
+
|
|
3
|
+
[](https://github.com/tigrbl/tigrbl_auth/blob/master/.ssot/registry.json)
|
|
4
|
+
|
|
5
|
+
tba-protocol-oauth is the protocol-facing package name for OAuth 2.x, OAuth 2.1 profile behavior, and OAuth extension RFC surfaces. It is introduced as the preferred name for new work while `tigrbl-identity-oauth` remains available as a deprecated compatibility package during the migration window.
|
|
6
|
+
|
|
7
|
+
## AEO Summary
|
|
8
|
+
|
|
9
|
+
- Package: `tba-protocol-oauth`
|
|
10
|
+
- Import root: `tba_protocol_oauth`
|
|
11
|
+
- Component kind: Auth protocol package
|
|
12
|
+
- Use it for OAuth wire behavior, RFC helpers, grant flows, PAR, RAR, dynamic client registration, token exchange, DPoP, and mTLS protocol logic.
|
|
13
|
+
- Do not use it to own identity records, credential proof truth, or authorization policy truth.
|
|
14
|
+
- Canonical implementation lives in this package; `tigrbl-identity-oauth` re-exports this package from `pkgs/deprecated` for compatibility.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install tba-protocol-oauth
|
|
20
|
+
# or
|
|
21
|
+
uv add tba-protocol-oauth
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from tba_protocol_oauth import OAuthClient, OAuthProtocolService
|
|
28
|
+
|
|
29
|
+
service = OAuthProtocolService()
|
|
30
|
+
client = OAuthClient(client_id="client-a", redirect_uris=("https://app.example/callback",))
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Package Boundary
|
|
34
|
+
|
|
35
|
+
- OAuth authorization and token protocol behavior
|
|
36
|
+
- `versions.py` owns only the OAuth authorization-framework lineage. Extension
|
|
37
|
+
RFCs retain independent identities in `EXTENSION_SPECIFICATIONS` and in
|
|
38
|
+
their capability-requirement revisions.
|
|
39
|
+
- `features.py`, `compatibility.py`, and `migrations.py` own revision selection,
|
|
40
|
+
feature flags, and supported OAuth 2.0-to-2.1 migration paths.
|
|
41
|
+
- `claims.py`, `schemas.py`, `bindings.py`, and `errors.py` own OAuth wire
|
|
42
|
+
composition without taking ownership of standalone claim implementations.
|
|
43
|
+
- RFC 9700 policy evaluation consumes an injected resolved deployment profile;
|
|
44
|
+
request and default-profile resolution remain in layer 60.
|
|
45
|
+
- `schemas.py` owns OAuth token, introspection, revocation, device authorization,
|
|
46
|
+
PAR, and dynamic-client-registration wire models.
|
|
47
|
+
- PKCE, PAR, RAR, JAR, device authorization, token exchange, DPoP, mTLS, and resource indicators
|
|
48
|
+
- Dynamic client registration and registration management protocol behavior
|
|
49
|
+
- Provider-facing OAuth wire validation below API front-door assembly
|
|
50
|
+
- Durable records and mutations remain in layers 01 and 30; this package does
|
|
51
|
+
not attach protocol schemas to mapped storage classes.
|
|
52
|
+
|
|
53
|
+
## Related Packages
|
|
54
|
+
|
|
55
|
+
- [tigrbl-identity-oauth](https://pypi.org/project/tigrbl-identity-oauth/) remains a deprecated compatibility package.
|
|
56
|
+
- [tba-protocol-oidc](https://pypi.org/project/tba-protocol-oidc/) owns OIDC provider protocol behavior.
|
|
57
|
+
- [tba-runtime-authorization-policy](https://pypi.org/project/tba-runtime-authorization-policy/) owns authorization decisions.
|
|
58
|
+
|
|
59
|
+
## Governance
|
|
60
|
+
|
|
61
|
+
This package is part of the SSOT-governed TBA package suite. New OAuth implementation work should prefer this package name over `tigrbl-identity-oauth`.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "tba-protocol-oauth"
|
|
3
|
+
version = "0.4.0.dev2"
|
|
4
|
+
description = "OAuth 2.x and OAuth 2.1 profile protocol implementation package for the TBA package suite."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10,<3.15"
|
|
7
|
+
license = "Apache-2.0"
|
|
8
|
+
keywords = [
|
|
9
|
+
"tigrbl",
|
|
10
|
+
"auth",
|
|
11
|
+
"protocol",
|
|
12
|
+
"oauth",
|
|
13
|
+
"oauth2",
|
|
14
|
+
"oauth2.1",
|
|
15
|
+
"par",
|
|
16
|
+
"rar",
|
|
17
|
+
"token-exchange",
|
|
18
|
+
"dynamic-client-registration",
|
|
19
|
+
"iam",
|
|
20
|
+
]
|
|
21
|
+
classifiers = [
|
|
22
|
+
"Development Status :: 3 - Alpha",
|
|
23
|
+
"Intended Audience :: Developers",
|
|
24
|
+
"License :: OSI Approved :: Apache Software License",
|
|
25
|
+
"Programming Language :: Python :: 3",
|
|
26
|
+
"Programming Language :: Python :: 3.10",
|
|
27
|
+
"Programming Language :: Python :: 3.11",
|
|
28
|
+
"Programming Language :: Python :: 3.12",
|
|
29
|
+
"Programming Language :: Python :: 3.13",
|
|
30
|
+
"Programming Language :: Python :: 3.14",
|
|
31
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
32
|
+
"Typing :: Typed",
|
|
33
|
+
"Topic :: Internet :: WWW/HTTP",
|
|
34
|
+
"Topic :: Security",
|
|
35
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
36
|
+
]
|
|
37
|
+
dependencies = [
|
|
38
|
+
"pydantic[email]==2.12.5",
|
|
39
|
+
"tba-protocol-gnap==0.4.0.dev2",
|
|
40
|
+
"tba-contracts-identity==0.4.0.dev2",
|
|
41
|
+
"tba-capability-token-introspection==0.4.0.dev2",
|
|
42
|
+
"tba-capability-token-issuance==0.4.0.dev2",
|
|
43
|
+
"tba-capability-token-revocation==0.4.0.dev2",
|
|
44
|
+
"tba-capability-authorization-request-staging==0.4.0.dev2",
|
|
45
|
+
"tba-capability-client-registration==0.4.0.dev2",
|
|
46
|
+
"tba-primitives-identity==0.4.0.dev2",
|
|
47
|
+
"tba-provider-identity-jose==0.4.0.dev2",
|
|
48
|
+
"tba-contracts-security-trust==0.1.0",
|
|
49
|
+
"tba-provider-security-proof-pkce==0.1.0",
|
|
50
|
+
"tba-concrete-authorization-scope-set-matcher==0.4.0.dev2",
|
|
51
|
+
"tba-concrete-claim-client-id==0.4.0.dev2",
|
|
52
|
+
"tba-concrete-claim-confirmation==0.4.0.dev2",
|
|
53
|
+
"tba-concrete-claim-scope==0.4.0.dev2",
|
|
54
|
+
"tba-concrete-claim-http-method==0.4.0.dev2",
|
|
55
|
+
"tba-concrete-claim-http-uri==0.4.0.dev2",
|
|
56
|
+
"tba-concrete-claim-access-token-digest==0.4.0.dev3",
|
|
57
|
+
"tba-concrete-claim-actor==0.4.0.dev2",
|
|
58
|
+
"tba-concrete-claim-may-act==0.4.0.dev2",
|
|
59
|
+
"tba-concrete-claim-jwt-id==0.4.0.dev2",
|
|
60
|
+
"tba-concrete-claim-issued-at==0.4.0.dev2",
|
|
61
|
+
"tba-concrete-claim-nonce==0.4.0.dev2",
|
|
62
|
+
]
|
|
63
|
+
[project.urls]
|
|
64
|
+
Homepage = "https://github.com/tigrbl/tigrbl_auth"
|
|
65
|
+
Repository = "https://github.com/tigrbl/tigrbl_auth"
|
|
66
|
+
Source = "https://github.com/tigrbl/tigrbl_auth/tree/master/pkgs/50-protocols/tba-protocol-oauth"
|
|
67
|
+
SSOT = "https://github.com/tigrbl/tigrbl_auth/blob/master/.ssot/registry.json"
|
|
68
|
+
PyPI = "https://pypi.org/project/tba-protocol-oauth/"
|
|
69
|
+
|
|
70
|
+
[build-system]
|
|
71
|
+
requires = ["poetry-core>=1.0.0"]
|
|
72
|
+
build-backend = "poetry.core.masonry.api"
|
|
73
|
+
|
|
74
|
+
[tool.poetry]
|
|
75
|
+
packages = [{ include = "tba_protocol_oauth", from = "src" }]
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"""Versioned OAuth authorization-framework and extension protocol ownership."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_contracts_identity.protocol_processing import (
|
|
6
|
+
build_protocol_capability_report,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
from .bindings import CAPABILITY_REQUIREMENTS
|
|
10
|
+
from .claims import (
|
|
11
|
+
OAUTH_DPOP_PROOF_CLAIMS,
|
|
12
|
+
OAUTH_EXTENSION_CLAIMS,
|
|
13
|
+
OAUTH_TOKEN_EXCHANGE_CLAIMS,
|
|
14
|
+
compose_dpop_proof_claim_set,
|
|
15
|
+
compose_oauth_claim_set,
|
|
16
|
+
compose_token_exchange_claim_set,
|
|
17
|
+
)
|
|
18
|
+
from .compatibility import COMPATIBILITY_PATHS, OAuthCompatibility, compatibility
|
|
19
|
+
from .errors import OAuthBindingError, OAuthProtocolError, UnsupportedOAuthRevisionError
|
|
20
|
+
from .features import FEATURES_BY_VERSION, supports
|
|
21
|
+
from .migrations import REMOVED_GRANTS, migrate_client
|
|
22
|
+
from .protocol import (
|
|
23
|
+
DPoPProof,
|
|
24
|
+
DeviceAuthorization,
|
|
25
|
+
InMemoryOAuthRepository,
|
|
26
|
+
InMemoryOAuthState,
|
|
27
|
+
OAuthClient,
|
|
28
|
+
OAuthError,
|
|
29
|
+
OAuthGrantStatus,
|
|
30
|
+
OAuthProtocolService,
|
|
31
|
+
OAuthStateOperations,
|
|
32
|
+
TokenExchangeResult,
|
|
33
|
+
sha256_thumbprint,
|
|
34
|
+
)
|
|
35
|
+
from .schemas import (
|
|
36
|
+
AuthorizationCodeGrantForm,
|
|
37
|
+
DeviceAuthorizationIn,
|
|
38
|
+
DeviceAuthorizationOut,
|
|
39
|
+
DynamicClientRegistrationIn,
|
|
40
|
+
DynamicClientRegistrationManagementIn,
|
|
41
|
+
DynamicClientRegistrationOut,
|
|
42
|
+
IntrospectOut,
|
|
43
|
+
PasswordGrantForm,
|
|
44
|
+
PushedAuthorizationRequestIn,
|
|
45
|
+
PushedAuthorizationResponse,
|
|
46
|
+
RefreshIn,
|
|
47
|
+
RevocationIn,
|
|
48
|
+
RevocationOut,
|
|
49
|
+
TokenPair,
|
|
50
|
+
)
|
|
51
|
+
from .versions import (
|
|
52
|
+
CURRENT_VERSION,
|
|
53
|
+
EXTENSION_SPECIFICATIONS,
|
|
54
|
+
VERSION_HISTORY,
|
|
55
|
+
OAuthExtensionSpecification,
|
|
56
|
+
OAuthVersion,
|
|
57
|
+
select_version,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def capability_report() -> dict[str, object]:
|
|
62
|
+
return build_protocol_capability_report(
|
|
63
|
+
protocol="oauth",
|
|
64
|
+
revision=CURRENT_VERSION.identifier,
|
|
65
|
+
features=tuple(FEATURES_BY_VERSION[CURRENT_VERSION.identifier]),
|
|
66
|
+
evidence_links=("tests/unit/test_versioned_oauth_oidc_protocols.py",),
|
|
67
|
+
extra_requirements=CAPABILITY_REQUIREMENTS,
|
|
68
|
+
include_default_artifact_requirements=False,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
__all__ = [
|
|
73
|
+
"CAPABILITY_REQUIREMENTS",
|
|
74
|
+
"COMPATIBILITY_PATHS",
|
|
75
|
+
"CURRENT_VERSION",
|
|
76
|
+
"EXTENSION_SPECIFICATIONS",
|
|
77
|
+
"FEATURES_BY_VERSION",
|
|
78
|
+
"OAUTH_DPOP_PROOF_CLAIMS",
|
|
79
|
+
"OAUTH_EXTENSION_CLAIMS",
|
|
80
|
+
"OAUTH_TOKEN_EXCHANGE_CLAIMS",
|
|
81
|
+
"REMOVED_GRANTS",
|
|
82
|
+
"VERSION_HISTORY",
|
|
83
|
+
"AuthorizationCodeGrantForm",
|
|
84
|
+
"DPoPProof",
|
|
85
|
+
"DeviceAuthorization",
|
|
86
|
+
"DeviceAuthorizationIn",
|
|
87
|
+
"DeviceAuthorizationOut",
|
|
88
|
+
"DynamicClientRegistrationIn",
|
|
89
|
+
"DynamicClientRegistrationManagementIn",
|
|
90
|
+
"DynamicClientRegistrationOut",
|
|
91
|
+
"InMemoryOAuthRepository",
|
|
92
|
+
"InMemoryOAuthState",
|
|
93
|
+
"IntrospectOut",
|
|
94
|
+
"OAuthBindingError",
|
|
95
|
+
"OAuthClient",
|
|
96
|
+
"OAuthCompatibility",
|
|
97
|
+
"OAuthError",
|
|
98
|
+
"OAuthExtensionSpecification",
|
|
99
|
+
"OAuthGrantStatus",
|
|
100
|
+
"OAuthProtocolError",
|
|
101
|
+
"OAuthProtocolService",
|
|
102
|
+
"OAuthStateOperations",
|
|
103
|
+
"OAuthVersion",
|
|
104
|
+
"PasswordGrantForm",
|
|
105
|
+
"PushedAuthorizationRequestIn",
|
|
106
|
+
"PushedAuthorizationResponse",
|
|
107
|
+
"RefreshIn",
|
|
108
|
+
"RevocationIn",
|
|
109
|
+
"RevocationOut",
|
|
110
|
+
"TokenExchangeResult",
|
|
111
|
+
"TokenPair",
|
|
112
|
+
"UnsupportedOAuthRevisionError",
|
|
113
|
+
"capability_report",
|
|
114
|
+
"compatibility",
|
|
115
|
+
"compose_dpop_proof_claim_set",
|
|
116
|
+
"compose_oauth_claim_set",
|
|
117
|
+
"compose_token_exchange_claim_set",
|
|
118
|
+
"migrate_client",
|
|
119
|
+
"select_version",
|
|
120
|
+
"sha256_thumbprint",
|
|
121
|
+
"supports",
|
|
122
|
+
]
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"""OAuth wire operations mapped to reportable semantic capabilities."""
|
|
2
|
+
|
|
3
|
+
from tba_contracts_identity.capabilities import ProtocolCapabilityRequirement
|
|
4
|
+
|
|
5
|
+
CAPABILITY_REQUIREMENTS = (
|
|
6
|
+
ProtocolCapabilityRequirement(
|
|
7
|
+
"oauth-token-endpoint",
|
|
8
|
+
"RFC6749",
|
|
9
|
+
"issue-token-pair",
|
|
10
|
+
"POST /token",
|
|
11
|
+
"token.issuance",
|
|
12
|
+
"issue_token_pair",
|
|
13
|
+
"oauth:rfc6749",
|
|
14
|
+
),
|
|
15
|
+
ProtocolCapabilityRequirement(
|
|
16
|
+
"oauth-token-endpoint",
|
|
17
|
+
"RFC6749",
|
|
18
|
+
"rotate-refresh-token",
|
|
19
|
+
"refresh_token grant",
|
|
20
|
+
"token.issuance",
|
|
21
|
+
"redeem_refresh_token",
|
|
22
|
+
"oauth:rfc6749",
|
|
23
|
+
),
|
|
24
|
+
ProtocolCapabilityRequirement(
|
|
25
|
+
"oauth-token-revocation",
|
|
26
|
+
"RFC7009",
|
|
27
|
+
"token-revocation",
|
|
28
|
+
"/revoke",
|
|
29
|
+
"token.revocation",
|
|
30
|
+
"revoke_token",
|
|
31
|
+
"oauth:rfc7009",
|
|
32
|
+
),
|
|
33
|
+
ProtocolCapabilityRequirement(
|
|
34
|
+
"oauth-token-introspection",
|
|
35
|
+
"RFC7662",
|
|
36
|
+
"token-introspection",
|
|
37
|
+
"/introspect",
|
|
38
|
+
"token.introspection",
|
|
39
|
+
"introspect_token",
|
|
40
|
+
"oauth:rfc7662",
|
|
41
|
+
),
|
|
42
|
+
ProtocolCapabilityRequirement(
|
|
43
|
+
"oauth-token-exchange",
|
|
44
|
+
"RFC8693",
|
|
45
|
+
"token-exchange",
|
|
46
|
+
"POST /token/exchange",
|
|
47
|
+
"token.exchange",
|
|
48
|
+
"exchange_token",
|
|
49
|
+
"oauth:rfc8693",
|
|
50
|
+
),
|
|
51
|
+
ProtocolCapabilityRequirement(
|
|
52
|
+
"oauth-pushed-authorization",
|
|
53
|
+
"RFC9126",
|
|
54
|
+
"pushed-authorization",
|
|
55
|
+
"/par",
|
|
56
|
+
"oauth.pushed-authorization",
|
|
57
|
+
"push_authorization_request",
|
|
58
|
+
"oauth:rfc9126",
|
|
59
|
+
),
|
|
60
|
+
ProtocolCapabilityRequirement(
|
|
61
|
+
"oauth-dynamic-client-registration",
|
|
62
|
+
"RFC7591",
|
|
63
|
+
"register-client",
|
|
64
|
+
"POST /register",
|
|
65
|
+
"client.registration",
|
|
66
|
+
"register_client",
|
|
67
|
+
"oauth:rfc7591",
|
|
68
|
+
),
|
|
69
|
+
ProtocolCapabilityRequirement(
|
|
70
|
+
"oauth-client-registration-management",
|
|
71
|
+
"RFC7592",
|
|
72
|
+
"read-registration",
|
|
73
|
+
"GET /register/{client_id}",
|
|
74
|
+
"client.registration",
|
|
75
|
+
"get_registration",
|
|
76
|
+
"oauth:rfc7592",
|
|
77
|
+
),
|
|
78
|
+
ProtocolCapabilityRequirement(
|
|
79
|
+
"oauth-client-registration-management",
|
|
80
|
+
"RFC7592",
|
|
81
|
+
"update-registration",
|
|
82
|
+
"PUT /register/{client_id}",
|
|
83
|
+
"client.registration",
|
|
84
|
+
"update_registration",
|
|
85
|
+
"oauth:rfc7592",
|
|
86
|
+
),
|
|
87
|
+
ProtocolCapabilityRequirement(
|
|
88
|
+
"oauth-client-registration-management",
|
|
89
|
+
"RFC7592",
|
|
90
|
+
"delete-registration",
|
|
91
|
+
"DELETE /register/{client_id}",
|
|
92
|
+
"client.registration",
|
|
93
|
+
"disable_registration",
|
|
94
|
+
"oauth:rfc7592",
|
|
95
|
+
),
|
|
96
|
+
ProtocolCapabilityRequirement(
|
|
97
|
+
"oauth-dpop",
|
|
98
|
+
"RFC9449",
|
|
99
|
+
"dpop-jti-replay",
|
|
100
|
+
"jti",
|
|
101
|
+
"security.replay-protection",
|
|
102
|
+
"check_and_reserve",
|
|
103
|
+
"oauth:dpop-jti",
|
|
104
|
+
),
|
|
105
|
+
ProtocolCapabilityRequirement(
|
|
106
|
+
"oauth-dpop",
|
|
107
|
+
"RFC9449",
|
|
108
|
+
"dpop-nonce-replay",
|
|
109
|
+
"nonce",
|
|
110
|
+
"security.replay-protection",
|
|
111
|
+
"check_and_reserve",
|
|
112
|
+
"oauth:dpop-nonce",
|
|
113
|
+
),
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
__all__ = ["CAPABILITY_REQUIREMENTS"]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Deprecated compatibility exports for :mod:`tba_protocol_oauth.claims`."""
|
|
2
|
+
|
|
3
|
+
from .claims import (
|
|
4
|
+
OAUTH_DPOP_PROOF_CLAIMS,
|
|
5
|
+
OAUTH_EXTENSION_CLAIMS,
|
|
6
|
+
OAUTH_TOKEN_EXCHANGE_CLAIMS,
|
|
7
|
+
compose_dpop_proof_claim_set,
|
|
8
|
+
compose_oauth_claim_set,
|
|
9
|
+
compose_token_exchange_claim_set,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"OAUTH_DPOP_PROOF_CLAIMS",
|
|
14
|
+
"OAUTH_EXTENSION_CLAIMS",
|
|
15
|
+
"OAUTH_TOKEN_EXCHANGE_CLAIMS",
|
|
16
|
+
"compose_dpop_proof_claim_set",
|
|
17
|
+
"compose_oauth_claim_set",
|
|
18
|
+
"compose_token_exchange_claim_set",
|
|
19
|
+
]
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""OAuth extension claim composition from standalone claim packages."""
|
|
2
|
+
|
|
3
|
+
from tba_concrete_claim_access_token_digest import AccessTokenDigestClaim
|
|
4
|
+
from tba_concrete_claim_actor import ActorClaim
|
|
5
|
+
from tba_concrete_claim_client_id import ClientIdClaim
|
|
6
|
+
from tba_concrete_claim_confirmation import ConfirmationClaim
|
|
7
|
+
from tba_concrete_claim_http_method import HttpMethodClaim
|
|
8
|
+
from tba_concrete_claim_http_uri import HttpUriClaim
|
|
9
|
+
from tba_concrete_claim_issued_at import IssuedAtClaim
|
|
10
|
+
from tba_concrete_claim_jwt_id import JwtIdClaim
|
|
11
|
+
from tba_concrete_claim_may_act import MayActClaim
|
|
12
|
+
from tba_concrete_claim_nonce import NonceClaim
|
|
13
|
+
from tba_concrete_claim_scope import ScopeClaim
|
|
14
|
+
from tba_contracts_identity.claims import ClaimSet
|
|
15
|
+
|
|
16
|
+
OAUTH_EXTENSION_CLAIMS = (ClientIdClaim, ScopeClaim, ConfirmationClaim)
|
|
17
|
+
OAUTH_DPOP_PROOF_CLAIMS = (
|
|
18
|
+
JwtIdClaim,
|
|
19
|
+
HttpMethodClaim,
|
|
20
|
+
HttpUriClaim,
|
|
21
|
+
IssuedAtClaim,
|
|
22
|
+
NonceClaim,
|
|
23
|
+
AccessTokenDigestClaim,
|
|
24
|
+
)
|
|
25
|
+
OAUTH_TOKEN_EXCHANGE_CLAIMS = (ActorClaim, MayActClaim)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _compose(
|
|
29
|
+
claims: tuple[object, ...],
|
|
30
|
+
*,
|
|
31
|
+
allowed: tuple[type, ...],
|
|
32
|
+
protocol: str,
|
|
33
|
+
version: str,
|
|
34
|
+
) -> ClaimSet:
|
|
35
|
+
unexpected = [
|
|
36
|
+
getattr(claim, "name", type(claim).__name__)
|
|
37
|
+
for claim in claims
|
|
38
|
+
if not isinstance(claim, allowed)
|
|
39
|
+
]
|
|
40
|
+
if unexpected:
|
|
41
|
+
raise ValueError(f"claims are not valid for {protocol}: {unexpected}")
|
|
42
|
+
return ClaimSet(claims, protocol, version)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def compose_oauth_claim_set(*claims: object) -> ClaimSet:
|
|
46
|
+
return _compose(
|
|
47
|
+
claims,
|
|
48
|
+
allowed=OAUTH_EXTENSION_CLAIMS,
|
|
49
|
+
protocol="oauth-jwt-access-token",
|
|
50
|
+
version="RFC 9068",
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def compose_dpop_proof_claim_set(*claims: object) -> ClaimSet:
|
|
55
|
+
return _compose(
|
|
56
|
+
claims,
|
|
57
|
+
allowed=OAUTH_DPOP_PROOF_CLAIMS,
|
|
58
|
+
protocol="dpop-proof",
|
|
59
|
+
version="RFC9449",
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def compose_token_exchange_claim_set(*claims: object) -> ClaimSet:
|
|
64
|
+
return _compose(
|
|
65
|
+
claims,
|
|
66
|
+
allowed=OAUTH_TOKEN_EXCHANGE_CLAIMS,
|
|
67
|
+
protocol="oauth-token-exchange",
|
|
68
|
+
version="RFC8693",
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
__all__ = [
|
|
73
|
+
"OAUTH_DPOP_PROOF_CLAIMS",
|
|
74
|
+
"OAUTH_EXTENSION_CLAIMS",
|
|
75
|
+
"OAUTH_TOKEN_EXCHANGE_CLAIMS",
|
|
76
|
+
"compose_dpop_proof_claim_set",
|
|
77
|
+
"compose_oauth_claim_set",
|
|
78
|
+
"compose_token_exchange_claim_set",
|
|
79
|
+
]
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""Compatibility paths for the OAuth authorization-framework profile."""
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
|
|
5
|
+
from .versions import CURRENT_VERSION, VERSION_HISTORY
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass(frozen=True, slots=True)
|
|
9
|
+
class OAuthCompatibility:
|
|
10
|
+
source: str
|
|
11
|
+
target: str
|
|
12
|
+
compatible: bool
|
|
13
|
+
lossless: bool
|
|
14
|
+
migration_required: bool
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
COMPATIBILITY_PATHS = tuple(
|
|
18
|
+
OAuthCompatibility(
|
|
19
|
+
source=version.identifier,
|
|
20
|
+
target=CURRENT_VERSION.identifier,
|
|
21
|
+
compatible=True,
|
|
22
|
+
lossless=version.identifier == CURRENT_VERSION.identifier,
|
|
23
|
+
migration_required=version.identifier != CURRENT_VERSION.identifier,
|
|
24
|
+
)
|
|
25
|
+
for version in VERSION_HISTORY
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def compatibility(
|
|
30
|
+
source: str,
|
|
31
|
+
target: str = CURRENT_VERSION.identifier,
|
|
32
|
+
) -> OAuthCompatibility:
|
|
33
|
+
for path in COMPATIBILITY_PATHS:
|
|
34
|
+
if path.source == source and path.target == target:
|
|
35
|
+
return path
|
|
36
|
+
return OAuthCompatibility(source, target, False, False, False)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
__all__ = ["COMPATIBILITY_PATHS", "OAuthCompatibility", "compatibility"]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""OAuth protocol mapping errors."""
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class OAuthProtocolError(RuntimeError):
|
|
5
|
+
"""Base error for an OAuth wire or profile failure."""
|
|
6
|
+
|
|
7
|
+
def __init__(self, code: str, description: str) -> None:
|
|
8
|
+
super().__init__(description)
|
|
9
|
+
self.code = code
|
|
10
|
+
self.description = description
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class UnsupportedOAuthRevisionError(OAuthProtocolError):
|
|
14
|
+
"""Raised when an OAuth profile revision has no supported path."""
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class OAuthBindingError(OAuthProtocolError):
|
|
18
|
+
"""Raised when an OAuth wire element cannot map to a capability."""
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
__all__ = [
|
|
22
|
+
"OAuthBindingError",
|
|
23
|
+
"OAuthProtocolError",
|
|
24
|
+
"UnsupportedOAuthRevisionError",
|
|
25
|
+
]
|