Rask.Auth 0.20.1-alpha.0.228

This is a prerelease version of Rask.Auth.
dotnet add package Rask.Auth --version 0.20.1-alpha.0.228
                    
NuGet\Install-Package Rask.Auth -Version 0.20.1-alpha.0.228
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rask.Auth" Version="0.20.1-alpha.0.228" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rask.Auth" Version="0.20.1-alpha.0.228" />
                    
Directory.Packages.props
<PackageReference Include="Rask.Auth" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Rask.Auth --version 0.20.1-alpha.0.228
                    
#r "nuget: Rask.Auth, 0.20.1-alpha.0.228"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Rask.Auth@0.20.1-alpha.0.228
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Rask.Auth&version=0.20.1-alpha.0.228&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Rask.Auth&version=0.20.1-alpha.0.228&prerelease
                    
Install as a Cake Tool

Rask.Auth

Accounts for a Rask app: register, sign in, sign out, plus email confirmation and password reset.

Accounts are backed by ASP.NET Core Identity (versioned password hashing, lockout, security stamps, token providers), wrapped behind Rask's own host-neutral surface. The code you write to read the current user or gate a page does not change between hosts.

// the same three calls on the Server host, in WebAssembly, and inside an island
public sealed class LoginForm(IAuth auth) : Component
{
    private async Task SubmitAsync(Credentials c) =>
        await auth.SignInAsync(c.Email, c.Password, returnUrl: "/");
}

// reading who is signed in — unchanged, and the same everywhere
public sealed class Header(IUserProvider users) : Component
{
    protected override Component Render() =>
        Authorize
            .NotAuthorized(NavLink.Href("/login")["Sign in"])
            .Authorized(user => Span[$"Hi, {user.Identity?.Name}"]);
}

Confirming an address, and resetting a password

Registering emails a confirmation link; /forgot-password emails a reset link. Both go out through the app's own mail queue, and /reset-password and /confirm-email are where those links land — built-in pages, overridable exactly like /login.

Confirmation does not block sign-in by default. A freshly scaffolded app has no SMTP configured, so requiring it out of the box would let the first registration succeed and then be unable to sign in, with the email that would fix it being the one that cannot be sent. Turn it on in one line:

app.Configure(c => c.Auth.Configure(o =>
{
    o.RequireConfirmedEmail = true;
    o.PublicOrigin = "https://app.example.com";   // required behind a proxy
}));

PublicOrigin matters: an emailed link has to be absolute, and Rask never builds one from a forwarded host header — that value is attacker-controlled on a request that reaches the app directly, and a reset link built from it would send a working token to a domain of the attacker's choosing.

/forgot-password answers the same way whether or not the address has an account, so it cannot be used to find out which addresses are registered. A completed reset ends every other session for that account.

The first account is the administrator

The first account to register gets the admin role; every one after it gets user. There is no seeding migration and no create-admin command.

Because an app deployed with an empty user table and an open registration page is a land-grab, the first registration — and only the first — needs a one-time token, generated while the instance is unclaimed and written to the startup log. Every registration after it is an ordinary open one.

The single-winner guarantee is a constant primary key on one row, not a count of the users table: two registrations arriving together cannot both award themselves the role, on any database provider.

Getting started

builder.Services.AddRaskAuth<AppDbContext>();
protected override void OnModelCreating(ModelBuilder modelBuilder) => modelBuilder.AddRaskAuth();

Then rask db add AddAuth && rask db update.

In an app that references the Rask meta-package this is already wired — auth is on by default, and app.Configure(c => c.Auth.Off()) is how an app does without it.

Full documentation: rask.sh · docs/authentication.md

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Rask.Auth:

Package Downloads
Rask

The one reference a Rask application needs, server or browser. On net10.0 it brings the ASP.NET host plus every battery — database, mediator, background jobs, transactional email, cache, outbox, operator dashboard, durable logs, Web Push, and SQLite snapshots and continuous backup — with RaskApp.Create(args) as the entry point. On net10.0-browser it brings the WebAssembly host, the source-generated mediator, the query cache and remote dispatch. Everything referenced is wired and on; app.Configure(c => c.Jobs.Off()) is how an app does without one. Reference Rask.Server for a lean host with no database.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.20.1-alpha.0.228 30 9/4/2026
0.20.1-alpha.0.227 29 9/4/2026
0.20.1-alpha.0.226 33 9/4/2026
0.20.1-alpha.0.225 34 9/4/2026
0.20.1-alpha.0.224 31 9/4/2026
0.20.1-alpha.0.223 38 9/4/2026