refactor(server)!: package structure, DI and OAuth hosting; working Blazor widgets #136
Labels
No labels
breaking-change
bug
documentation
duplicate
enhancement
good first issue
help wanted
performance
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Grandiras/ATProto.NET#136
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of the v0.7.0 update cycle (wave 7). Owner decisions:
Microsoft.Extensions.Http.Resilience.Packages
ATProtoNet.Server.EntityFrameworkCoreback out: the token store, the Spaces EF stores, both DbContexts and theirAdd*methods, keeping namespaceATProtoNet.Server.EntityFrameworkCore. Add it to the slnx, pack it, and add tests. Mind the Forgejo package linkage: the package ID predates 0.5.0.RedisSpaceReplayStore,StackExchange.Redis, the Redis tests andATPROTO_REDIS_URL.docs/spaces.mdshows the ~15-lineSET NX EXstore instead.Microsoft.Extensions.Http.Resilience. The builder exposes theIHttpClientBuilderso apps can add their own resilience (Aspire ServiceDefaults already do). Document that the SDK must not be combined with a handler that retries non-idempotent POSTs or replays DPoP proofs.ATProtoNet.Serverhas no NuGet dependencies beyond the shared framework.DI
services.AddAtProto(), which currently cannot resolveAtProtoClient:AddHttpClient<T>wins and the singleton is never registered. It returns anIAtProtoBuilder(Services,HttpClient) that the other registrations hang off:WithLifetime, replacingAddAtProtoScoped;AtProtoClientSettings.IOptions<T>with validation andValidateOnStart, and binds from configuration.Add*method.AddAtProtoServer()silently writes to%LocalAppData%.AddAtProtoServeroverloads. Use one HttpClient-name constant, and have OAuth use the factory.Auth
AtProtoAuthenticationHandler. It asks services to accept users' PDS access tokens, builds and leaks a client per request, and sets an emptydidclaim. The service-auth scheme replaces it.AtProtoOAuthService, options,AddAtProtoAuthentication,MapAtProtoOAuth) intoATProtoNet.Server. DeleteIOAuthClientProvider.OAuthClientis an options-built singleton, so refresh works after a restart.FileAtProtoTokenStore: lock-free reads and per-DID write locks (4.5× throughput at 64 concurrent callers).AtProtoClaimTypesconstants.OAuthException. Today any exception message lands in the login redirect URL.MapAtProtoOAuthcan serve/oauth-client-metadata.jsonand the JWKS.Blazor
FeedView,PostCard,ProfileCardandComposePostto a scoped current-user client resolved through the factory from the auth state. They currently inject an unregistered, non-userAtProtoClient.FeedSource(not a magic string); fixdocs/blazor.md.<SupportedPlatform Include="browser" />.InternalsVisibleTofor tests instead of 13 reflection calls.samples/ServerIntegrationSampleand cover each widget with a bUnit or render test.CHANGELOG
Breaking changes, with a migration section (package references, namespaces, registration calls).Follow-ups from the claude review of #167 (non-blocking, picked up here since #136 moves the OAuth hosting):
OAuthClient.ResolveFromServerUrlAsync: the success path callsResolveAuthorizationServerAsyncagain, redoing the protected-resource metadata fetch from thetryblock. The metadata cache absorbs it, but the second fetch and parse are wasted; pass the already-resolved result through.AtProtoOAuthService's cross-origin loopback relay: a relay entry that is never redeemed is not revoked when it expires. The session it holds stays live at the AS. This predates #167. Revoke on expiry or eviction when the hosting moves intoATProtoNet.Server.Splitting this into two PRs for reviewability, and so the first half doesn't wait on #133/#134:
issue-136-auth-hosting): the whole Auth and Blazor sections, the two #167 follow-ups above, the confidential-client hosting deferred from #132 (client keys in the hosted integration; serving the client metadata and JWKS), and the claim-type constants deferred from #125 (AtProtoServiceAuthDefaults→AtProtoClaimTypes).The issue closes with the second PR.