refactor(plugin): split plugin contract into partials and align namespaces - #45
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Splits the monolithic
IAuthKitPlugincontract from one 446-line file into per-concern partial declarations and moves them into aPluginContract/folder whose namespace mirrors the directory layout. The contract surface is now referenced through the explicitAuthKit.Plugins.Abstractions.Contracts.PluginContractnamespace instead of the looseContractsroot. Purely organizational, zero behavior change: the singleIAuthKitPlugintype and every default-implemented member survive intact.Contract split (
Contracts/PluginContract/)IAuthKitPlugin.cs- base identity and metadata accessors (Id,Name, ...,Metadata)IAuthKitPlugin.HostRequirements.cs-MinHostVersion,DependsOnIAuthKitPlugin.Configuration.cs-ConfigureServicesoverloads,BindConfigurationIAuthKitPlugin.Health.cs-CheckHealthAsyncIAuthKitPlugin.Pipeline.cs-MiddlewareType,MapEndpoints,ConfigureApplication,ConfigurePipelineIAuthKitPlugin.Security.cs-GetSecuritySchemes,ConfigureAuthentication,ConfigureAuthorizationIAuthKitPlugin.Lifecycle.cs- lifecycle hooks,GetHostedServicesThe interface deliberately stays a single type (
partial interface IAuthKitPlugin). Role sub-interfaces would break host hook detection, which relies on reflection that distinguishes overrides throughDeclaringType != typeof(IAuthKitPlugin).Namespace alignment
AuthKit.Plugins.Abstractions.Contracts.PluginContractDevTokens/DevToolsand the example plugin reference it viausing IAuthKitPlugin = AuthKit.Plugins.Abstractions.Contracts.PluginContract.IAuthKitPlugin;AuthKit.PluginContractValidatortool updated to the explicit namespacePlugin context configuration
DevTokensPluginandDevToolsPluginnow implementConfigureServices(IServiceCollection, AuthKitPluginContext)and bind options from the plugin-scopedcontext.Configurationsection instead of a hard-coded root sectionappsettings.jsonDevTokens options move from theAuthKit:root toPlugins:authkit.devtokensValidation
dotnet build AuthKit.slnxcompletes with zero errorsResult
The plugin contract is browseable instead of one wall of text: identity/host requirements, configuration, health, pipeline, security, and lifecycle hooks are each discoverable at a glance, every file's namespace matches its location, and the reference plugins demonstrate the context-scoped configuration pattern.