-
Notifications
You must be signed in to change notification settings - Fork 28
Basic OAuth and JWT support #649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
This needs some love in validation and token processing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
The PR implements foundational OAuth 2.0 and JWT support for the AYON Server.
- Adds
oauth_clientstable, indexes, and triggers to the database schema. - Introduces
OAuthStorage, OAuth server logic, and JWT utilities for token issuance and validation. - Exposes OAuth and OpenID Connect endpoints, including discovery, token, introspection, and userinfo.
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| schemas/schema.public.sql | Add oauth_clients table, indexes, and updated_at trigger |
| schemas/migrations/00000007_oauth.sql | Migration script mirroring the new oauth_clients schema |
| ayon_server/oauth/storage.py | Implement client and token persistence in PostgreSQL and Redis |
| ayon_server/oauth/server.py | Core OAuth2 server implementation using oauthlib |
| ayon_server/oauth/jwt_manager.py | JWT access and ID token creation, decoding, and JWKS endpoint |
| ayon_server/api/server.py | Add OpenID Connect discovery and JWKS endpoints |
| api/oauth/oauth_provider.py | Define FastAPI OAuth endpoints (authorize, token, consent, etc.) |
|
So I've tested it and it sort of works but there are several weak points/questions to be answered access token vs. oauthonce you get oauth access token, you shouldn't need ayon access token but you still do. Maybe we should support JWT issuerI wasn't able to figure out how to get the server name without access to Request object. Now, issuer is stupidly hardcoded and not validated. KeysNow we use JWT endpointIs very useful but right now it is using some hardcoded values. Maybe this should be turned into helper method to be used in individual addons for better context? |
|
you can use this little script for testing btw: https://gist.github.com/antirotor/7f5720a5ba168edac2c6c31825f46a2b
{
"clientName": "demo-client",
"redirectUris": [
"http://localhost:5000/callback"
],
"grantTypes": [
"authorization_code"
],
"responseTypes": [
"code"
],
"scope": "openid",
"clientType": "confidential"
}(note that
|
OAuth Provider Implementation for AYON Server
This implementation provides a basicOAuth 2.0 authorization server for AYON Server, allowing third-party applications to securely access user data through standardized OAuth processes. It is using oauthlib
Authorization Endpoints
GET /api/oauth/authorize- OAuth authorization endpointPOST /api/oauth/consent- User consent handlingPOST /api/oauth/token- Token exchange endpointPOST /api/oauth/introspect- Token introspection endpointGET /api/oauth/userinfo- User information endpointJWT Token Endpoints
POST /api/oauth/jwt- Generate JWT tokens (authenticated users)POST /api/oauth/jwt/exchange- Exchange OAuth tokens for JWT tokensGET /api/oauth/validate- Validate JWT tokensGET /.well-known/jwks.json- JSON Web Key SetClient Management (Admin Only)
GET /api/oauth/clients- List OAuth clientsPOST /api/oauth/clients- Create OAuth clientGET /api/oauth/clients/{client_id}- Get OAuth clientDELETE /api/oauth/clients/{client_id}- Delete OAuth clientDiscovery
GET /.well-known/openid_configuration- OpenID Connect DiscoveryNotes