Skip to content

feat!: managers, zero-value providers, and a fake, shaped after socialite - #2

Merged
arjendevos merged 1 commit into
mainfrom
what-is-missing-in-package
Sep 18, 2026
Merged

arjendevos merged 1 commit into
mainfrom
what-is-missing-in-package

Conversation

@arjendevos

Copy link
Copy Markdown
Contributor

The package is rebuilt around Socialite's own structure. New makes a
Manager, Socialite's SocialiteManager; Driver(name) on it hands back the
driver with Redirect, User, Callback, UserFromToken and RefreshToken, and
the chain of Scopes, SetScopes, With, RedirectURL and Stateless. There is
no package-level state, so an application makes its manager at boot and a
test makes its own and runs in parallel.

A provider is a zero value registered with WithDriver[T]: Socialite's four
abstract methods, Endpoint, Scoping, GetUserByToken and MapUserToStruct,
with the credentials passed in so a provider can carry an issuer, a host or
a client id. The driver fetches through the provider, maps through it, and
attaches the token and the approved scopes. Google, GitHub, GitLab,
Facebook, Bitbucket, LinkedIn, Slack, Twitch and X are built in, one file
each; an OpenID Connect provider declares its issuer and the ID token is
verified for signature, issuer, audience, expiry and nonce.

Fake swaps a driver for Socialite's FakeProvider: a redirect to a URL
nobody serves, the given user at the callback, and everything else
forwarded to the driver it replaced. The chain keeps the fake.

The handshake is an encrypted cookie under Key, or the application's own
Session. It carries state, the PKCE verifier and the nonce, expires after
ten minutes, and is spent whether the callback succeeds or not. PKCE is on
unless a provider says it cannot; the cookie is Secure over TLS or when
APIURL is https; a RedirectURL given as a path resolves against APIURL.

Tests cover the package at 99.3%, the remainder being error returns that
cannot occur. CI measures coverage of the package alone so the examples,
whose main cannot run under test, do not count against it.

…lite

The package is rebuilt around Socialite's own structure. New makes a
Manager, Socialite's SocialiteManager; Driver(name) on it hands back the
driver with Redirect, User, Callback, UserFromToken and RefreshToken, and
the chain of Scopes, SetScopes, With, RedirectURL and Stateless. There is
no package-level state, so an application makes its manager at boot and a
test makes its own and runs in parallel.

A provider is a zero value registered with WithDriver[T]: Socialite's four
abstract methods, Endpoint, Scoping, GetUserByToken and MapUserToStruct,
with the credentials passed in so a provider can carry an issuer, a host or
a client id. The driver fetches through the provider, maps through it, and
attaches the token and the approved scopes. Google, GitHub, GitLab,
Facebook, Bitbucket, LinkedIn, Slack, Twitch and X are built in, one file
each; an OpenID Connect provider declares its issuer and the ID token is
verified for signature, issuer, audience, expiry and nonce.

Fake swaps a driver for Socialite's FakeProvider: a redirect to a URL
nobody serves, the given user at the callback, and everything else
forwarded to the driver it replaced. The chain keeps the fake.

The handshake is an encrypted cookie under Key, or the application's own
Session. It carries state, the PKCE verifier and the nonce, expires after
ten minutes, and is spent whether the callback succeeds or not. PKCE is on
unless a provider says it cannot; the cookie is Secure over TLS or when
APIURL is https; a RedirectURL given as a path resolves against APIURL.

Tests cover the package at 99.3%, the remainder being error returns that
cannot occur. CI measures coverage of the package alone so the examples,
whose main cannot run under test, do not count against it.
@arjendevos
arjendevos merged commit c7e5c0f into main Sep 18, 2026
2 checks passed
@arjendevos
arjendevos deleted the what-is-missing-in-package branch September 18, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant