Open-source .NET packages for teams building CLI tools that sign users in through
their own OIDC provider, in the spirit of gh auth login and az login: browser or
device login, silent refresh, status, and logout.
Status: early development. Implemented: browser PKCE and device login, lazy discovery, ID-token validation, silent refresh, session coordination across threads and processes, memory storage, and explicitly selected plaintext file storage. Deterministic protocol tests and hosted runs against Keycloak, Duende IdentityServer, Auth0, and Microsoft Entra ID cover both flows and refresh. Not yet done: OS keyring storage, HTTP and DI integration, and packaging; see the roadmap.
| Package | Intended responsibility |
|---|---|
| Bijecta.CliAuth.Core | Authentication, flow adapters, contracts, session coordination, memory storage |
| Bijecta.CliAuth.Storage.File | Explicitly selected plaintext ITokenStore: compact JSON, atomic replacement, logout, matching session leases, and private-location checks |
| Bijecta.CliAuth.Storage.MacOS | Future macOS protected storage; design deferred |
| Bijecta.CliAuth.Storage.Linux | Future Linux protected storage; design deferred |
| Bijecta.CliAuth.Storage.Windows | Future Windows protected storage; design deferred |
| Bijecta.CliAuth.Extensions | Optional HTTP and DI integration |
Each storage package references Core only; Core and Extensions do not select or reference platform storage packages. Developers explicitly choose a backend or provide a conforming custom store. Shared storage internals are source code, not another public package. System.CommandLine is a sample dependency only.
See Architecture for responsibilities and runtime behavior, and the decision records for the reasoning behind architectural choices.
Install the SDK pinned in global.json, then run from this directory:
dotnet restore Bijecta.CliAuth.slnx --locked-mode
dotnet build Bijecta.CliAuth.slnx --configuration Release --no-restore
dotnet test --solution Bijecta.CliAuth.slnx --configuration Release --no-build
dotnet run --project samples/Bijecta.CliAuth.Sample.Cli -- --helpUse dotnet restore Bijecta.CliAuth.slnx --force-evaluate to update committed lock
files intentionally after changing dependencies. Test execution uses xUnit v3
with Microsoft.Testing.Platform. CI runs the build and package-boundary tests on
Windows, macOS, and Linux; it does not yet validate native storage on those OSes.
The OS matrix checks library and sample behavior on each host; it does not produce
three different versions of the portable Core package. NuGet packing/release checks
will be a separate step. Keycloak/Playwright tests use a separate integration solution
and Linux CI job; see integration prerequisites and commands.
Other providers use the provider tests and their own workflow.
The fixture helper is managed .NET code, with Native AOT disabled. CI builds every
library with -p:IsAotCompatible=true on Linux (trim and AOT warnings are errors; the
result does not depend on the OS), and on each OS publishes the sample with Native AOT
and smoke-tests the binary. The format check also runs on Linux only:
dotnet publish samples/Bijecta.CliAuth.Sample.Cli -c Release -r <rid> -p:PublishAot=true -o artifacts/aotThose builds restore without locked mode and rewrites lock files with runtime-specific
entries; discard those changes (git checkout -- '*.lock.json') rather than committing them.
See Core contracts, authenticator composition and
coordination, and the
compiled consumer example.
Browser/device login, local status, token acquisition with silent refresh
(ADR 0009), and logout work through the public authenticator. See the browser walkthrough
and device walkthrough, plus the
Keycloak development fixture. Missing selected provider
capabilities fail explicitly without switching flows. The sample's demo command uses
memory; its login, status, token, list, and logout commands persist sessions in
plaintext files under an explicit --storage-dir. ListSessionsAsync reports every
configured profile's status.
| Provider | Browser | Device | Refresh | Guide |
|---|---|---|---|---|
| Keycloak | ✅ | ✅ | ✅ | Keycloak |
| Duende IdentityServer | ✅ | ✅ | ✅ | Duende |
| Auth0 | ✅ | ✅ | ✅ | Auth0 |
| Microsoft Entra ID | ✅ | ✅ | ✅ | Entra ID |
| Okta | not tested | not tested | not tested | — |
✅ means a passing hosted CI run. Details, the legend, and the tested versions are in the compatibility table. Plain OAuth providers without OIDC (such as GitHub) and providers whose native clients need a client secret (such as Google) are out of scope.
The roadmap lists the ordered milestones. Done: an AOT guard, silent refresh, and provider compatibility. Next: OS keyring storage, login ergonomics (device login over SSH, a token override for scripts), the HTTP/DI integration layer, and then a first preview release.
The first preview stores tokens in the OS keyring by default; plaintext files stay an explicit opt-in. Workers, client credentials, and token exchange are outside scope. Dependency review, final license/author and repository metadata, security reporting setup, native backend tests, and release validation remain outstanding. Scaffold packages are not release artifacts.
The development workspace may keep its detailed design documents outside this repository. They are implementation guidance, not build inputs or package content.