-
Notifications
You must be signed in to change notification settings - Fork 0
Quick Start
Jonatan edited this page Aug 9, 2026
·
1 revision
This is the smallest supported host shape. It assumes Windows, .NET 10, and one selected DB provider.
Use either the SQLite or PostgreSQL package set from Installation.
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
builder.Services.AddSharpAccess(builder.Configuration, options =>
{
options.Features.PasswordAuthentication = true;
options.Features.Registration = true;
options.Features.PasswordReset = true;
options.Features.RefreshTokens = true;
});
// Choose exactly one:
builder.Services.AddSqliteAccess(builder.Configuration);
// builder.Services.AddPostgresAccess(builder.Configuration);
WebApplication app = builder.Build();
await app.Services.InitializeSharpAccessAsync(
app.Lifetime.ApplicationStopping);
app.UseSharpAccessExceptionHandling();
app.UseSharpAccessSecurityHeaders();
app.UseSharpAccess();
app.MapSharpAccessEndpoints();
await app.RunAsync();{
"SharpAccess": {
"BaseUri": "https://app.example.com",
"JwtIssuer": "example-auth",
"JwtAudience": "example-clients",
"AccessTokenSigning": {
"ActiveKeyId": "2026-08",
"HmacSha256Keys": {
"2026-08": {
"Key": "<protected-secret>",
"ActivatedUtc": "2026-08-01T00:00:00Z"
}
}
},
"TokenHashing": {
"CurrentKeyVersion": "v1",
"Keys": {
"v1": "<protected-secret>"
}
},
"Passwords": {
"CurrentPepperVersion": "v1",
"Peppers": {
"v1": "<protected-secret>"
}
},
"RateLimits": {
"PartitionKey": "<dedicated-protected-secret>"
},
"Features": {
"PasswordAuthentication": true,
"Registration": true,
"PasswordReset": true,
"RefreshTokens": true,
"Administration": false,
"Tenancy": false
}
},
"ConnectionStrings": {
"Auth": "<host-owned DB connection string>"
}
}Caution
Never commit signing keys, token-hashing keys, password peppers, rate-limit partition keys, OIDC credentials, Data Protection certificates, or DB connection strings.
From PowerShell 7:
dotnet restore SharpAccess.sln --locked-mode
dotnet run --project samples/SharpAccess.SampleApi/SharpAccess.SampleApi.csprojThe sample stores its first-run local secrets in Windows Credential Manager for the current user and does not write them into tracked configuration.
SharpAccess · Windows · .NET 10 · PowerShell 7 · Repository · Security · License