Skip to main content

Crate origin_auth

Crate origin_auth 

Source
Expand description

OAuth 2.0 for native applications (ADR-0015).

Implements the authorization code flow with PKCE, a loopback redirect, token storage in the OS credential store, and transparent refresh.

LoopbackRedirect::bind()      → redirect_uri
AuthorizationFlow::begin()    → authorization url + state + verifier
Opener::open_url()            → the user consents in their browser
RedirectListener::wait()      → code (state verified)
AuthorizationFlow::exchange() → TokenSet
TokenStore::save()            → OS credential store

Afterwards nothing calls the flow again: AccessTokenProvider hands out a valid access token and refreshes it when it is about to expire.

Structs§

AccessTokenProvider
Hands out a valid access token, refreshing when needed.
AuthorizationCode
The authorization code handed back by the provider, after state was verified.
AuthorizationFlow
The OAuth 2.0 authorization code flow with PKCE.
OAuthConfig
Everything needed to talk to one OAuth provider.
PendingAuthorization
A flow that has been started but not yet completed.
Pkce
Proof Key for Code Exchange (RFC 7636), S256 only.
TokenSet
The credentials of one authenticated account.
TokenStore
Credentials in the OS credential store, one entry per account (ADR-0016).

Traits§

RedirectListener
Receives the provider’s redirect.