@@ -5,77 +5,23 @@ A comprehensive Python SDK for OAuth 2.0 functionality implementing multiple OAu
55## Installation
66
77``` bash
8- pip install keycardai-oauth
8+ uv add keycardai-oauth
99```
1010
1111## Quick Start
1212
1313``` python
14- from keycardai.oauth import *
14+ from keycardai.oauth import Client
1515
16- # Token Exchange (RFC 8693)
17- exchange_client = TokenExchangeClient(" https://oauth.example.com/token" )
18- response = await exchange_client.exchange_token(
19- subject_token = " original_token" ,
20- subject_token_type = TokenTypes.ACCESS_TOKEN ,
21- resource = " https://api.example.com"
22- )
16+ with Client(" https://oauth.example.com/token" ) as client:
17+ response = await client.exchange_token(
18+ subject_token = " original_token" ,
19+ subject_token_type = TokenTypes.ACCESS_TOKEN ,
20+ resource = " https://api.example.com"
21+ )
2322
24- # Token Introspection (RFC 7662)
25- introspection_client = IntrospectionClient(
26- " https://auth.example.com/introspect" ,
27- " client_id" ,
28- " client_secret"
29- )
30- token_info = await introspection_client.introspect_token(" token_to_check" )
31-
32- # Token Revocation (RFC 7009)
33- revocation_client = RevocationClient(
34- " https://auth.example.com/revoke" ,
35- " client_id" ,
36- " client_secret"
37- )
38- await revocation_client.revoke_token(" token_to_revoke" )
3923```
4024
41- ## 🏗️ Architecture & Standards
42-
43- This SDK implements a comprehensive set of OAuth 2.0 standards:
44-
45- ### Core Token Operations
46-
47- | Standard | Module | Description |
48- | ----------| ---------| -------------|
49- | ** [ RFC 8693] ( https://datatracker.ietf.org/doc/html/rfc8693 ) ** | ` exchange.py ` | ** OAuth 2.0 Token Exchange** - Delegation and impersonation through standardized token exchange |
50- | ** [ RFC 7662] ( https://datatracker.ietf.org/doc/html/rfc7662 ) ** | ` introspection.py ` | ** Token Introspection** - Validate tokens and retrieve metadata |
51- | ** [ RFC 7009] ( https://datatracker.ietf.org/doc/html/rfc7009 ) ** | ` revocation.py ` | ** Token Revocation** - Invalidate access and refresh tokens |
52-
53- ### Authentication & Security
54-
55- | Standard | Module | Description |
56- | ----------| ---------| -------------|
57- | ** [ RFC 7523] ( https://datatracker.ietf.org/doc/html/rfc7523 ) ** | ` jwt_profile.py ` | ** JWT Client Authentication** - Private key JWT client authentication |
58- | ** [ RFC 9068] ( https://datatracker.ietf.org/doc/html/rfc9068 ) ** | ` jwt_profile.py ` | ** JWT Access Tokens** - Structured JWT access tokens |
59- | ** [ RFC 6750] ( https://datatracker.ietf.org/doc/html/rfc6750 ) ** | ` bearer.py ` | ** Bearer Token Usage** - HTTP Bearer token authentication |
60- | ** [ RFC 8705] ( https://datatracker.ietf.org/doc/html/rfc8705 ) ** | ` security.py ` | ** Mutual TLS** - Certificate-bound tokens and client authentication |
61-
62- ### Discovery & Extensions
63-
64- | Standard | Module | Description |
65- | ----------| ---------| -------------|
66- | ** [ RFC 8414] ( https://datatracker.ietf.org/doc/html/rfc8414 ) ** | ` discovery.py ` | ** Authorization Server Metadata** - Discover OAuth endpoints and capabilities |
67- | ** [ RFC 7636] ( https://datatracker.ietf.org/doc/html/rfc7636 ) ** | ` security.py ` | ** PKCE** - Proof Key for Code Exchange for public clients |
68- | ** [ RFC 9126] ( https://datatracker.ietf.org/doc/html/rfc9126 ) ** | ` security.py ` | ** Pushed Authorization Requests** - Enhanced security for authorization requests |
69-
70- ## Features
71-
72- - ✅ ** Comprehensive RFC Implementation** : Full implementation of 9+ OAuth 2.0 RFCs
73- - ✅ ** Type Safe** : Full type hints with Pydantic models
74- - ✅ ** Async Support** : Native async/await support for all operations
75- - ✅ ** Enterprise Ready** : Mutual TLS, certificate binding, and advanced security features
76- - ✅ ** Extensible** : Pluggable authentication and validation components
77- - ✅ ** Well Tested** : Comprehensive test suite with >90% coverage
78-
7925## Development
8026
8127This package is part of the [ KeycardAI Python SDK workspace] ( ../../README.md ) .
0 commit comments