Expand description
OAuth 2.0 provider abstraction.
The framework provides the trait and supporting types. Concrete providers
(Google, GitHub, etc.) are implemented in the application layer and
registered with OAuth2Service in the app’s ArclyPlugin::on_init.
§Flow (Authorization Code + PKCE)
-
GET /oauth/{provider}/authorize— controller callsprovider.authorize_url()which returns(url, pkce_verifier, csrf_state). — controller storesoauth_state::{state}→{verifier}::{provider}in Redis with a 10-minute TTL. — returns{ "url": "..." }to the client. -
GET /oauth/{provider}/callback?code=&state=— controller looks up state in Redis, extracts verifier + provider. — callsprovider.exchange_code(code, pkce_verifier)→ access token. — callsprovider.fetch_user_info(access_token)→OAuth2UserInfo. — upserts local user, mints JWT + session, returns both.
Structs§
- OAuth2
Service - Registry of OAuth2 providers keyed by
provider.name(). - OAuth2
User Info - Normalised user information returned by any OAuth2 provider.
Traits§
- OAuth2
Provider - Implement this to add an OAuth2 provider to the application.