FederatedAuthRealm.Sdk 0.4.16

dotnet add package FederatedAuthRealm.Sdk --version 0.4.16
                    
NuGet\Install-Package FederatedAuthRealm.Sdk -Version 0.4.16
                    
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="FederatedAuthRealm.Sdk" Version="0.4.16" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FederatedAuthRealm.Sdk" Version="0.4.16" />
                    
Directory.Packages.props
<PackageReference Include="FederatedAuthRealm.Sdk" />
                    
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 FederatedAuthRealm.Sdk --version 0.4.16
                    
#r "nuget: FederatedAuthRealm.Sdk, 0.4.16"
                    
#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 FederatedAuthRealm.Sdk@0.4.16
                    
#: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=FederatedAuthRealm.Sdk&version=0.4.16
                    
Install as a Cake Addin
#tool nuget:?package=FederatedAuthRealm.Sdk&version=0.4.16
                    
Install as a Cake Tool

Federated Auth Realm - SDK (.NET)

A lightweight .NET implementation of the Federated Auth Realm SDK.
It mirrors the TypeScript SDK feature set and provides a strongly typed, task-based API for authenticating users, refreshing sessions, and interacting with the SRWP discovery network.

Project layout

├── FederatedAuthRealm.Sdk.sln          # Solution file
└── src
    └── FederatedAuthRealm.Sdk
        ├── FederatedAuthRealmClient.cs # High-level auth client
        ├── SRWPDiscoveryClient.cs      # SRWP discovery helper
        ├── Models/                     # Shared contracts/enums
        ├── Storage/                    # Token storage abstractions
        └── Utils/JwtUtils.cs           # Minimal JWT helpers

Getting started

  1. Build the library

    dotnet build
    
  2. Reference the SDK

    Add a project reference to src/FederatedAuthRealm.Sdk/FederatedAuthRealm.Sdk.csproj or pack it into a NuGet package as needed.

Usage

using SavantRealms.FederatedAuthRealm.Sdk;
using SavantRealms.FederatedAuthRealm.Sdk.Models;

var client = new FederatedAuthRealmClient(new FederatedAuthRealmClientConfig
{
    BaseUrl = "https://api.federatedauthrealm.com",
    AppKey = "federated-auth-realm",
    OnSessionExpired = () => Console.WriteLine("Session expired"),
});

var response = await client.LoginAsync(new LoginRequest
{
    Email = "admin@example.com",
    Password = "Str0ngPassword!",
});

Console.WriteLine($"Authenticated as {response.User?.Email}");

Managing storage

The SDK uses an in-memory storage provider by default. You can plug in your own implementation (for example, wrapping ASP.NET Core IDistributedCache) by implementing IStorageProvider and supplying it via the FederatedAuthRealmClientConfig.

Discovery client

using SavantRealms.FederatedAuthRealm.Sdk;
using SavantRealms.FederatedAuthRealm.Sdk.Models;

var discovery = new SRWPDiscoveryClient("https://srwp.example.com");
var knownRealms = await discovery.GetKnownRealmsAsync();
await discovery.WhisperAsync(new SRWPWhisperRequest
{
    SourceRealm = "federated-auth-realm",
    SourceUrl = "https://api.federatedauthrealm.com",
    Timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
    KnownRealms = knownRealms,
});

Running tests

  • Everything (format verification + analyzers + tests):

    ./scripts/check-all.sh
    
  • Format sources in-place:

    ./scripts/format.sh
    
  • Run the test suite:

    ./scripts/test.sh
    

Git hooks & workflow automation

The repository contains local git hooks under .githooks. Install them with:

./scripts/install-hooks.sh

This sets core.hooksPath and wires up:

  • pre-commit → scripts/check-all.sh
  • pre-push → scripts/test.sh

Publishing helper

./scripts/publish.sh mirrors the TypeScript/JavaScript SDK publish flow:

  1. Restores dependencies and runs both style/analyzer formatters.
  2. Executes the test suite.
  3. Packs the library into ./dist/*.nupkg.
  4. Optionally pushes the package to NuGet when NUGET_API_KEY (and optional NUGET_SOURCE) are provided.
    Use DRY_RUN=true to skip publishing.

Example usage:

# Build/test/pack only
./scripts/publish.sh

# Publish to nuget.org
NUGET_API_KEY=XXXXX ./scripts/publish.sh

# Publish to a custom feed
NUGET_API_KEY=XXXXX NUGET_SOURCE="https://example.com/v3/index.json" ./scripts/publish.sh
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.4.16 111 3/22/2026
0.4.15 117 3/22/2026
0.4.12 357 1/24/2026
0.4.11 120 1/11/2026
0.4.10 117 1/11/2026
0.4.9 118 1/11/2026
0.4.8 122 1/11/2026
0.4.7 118 1/11/2026
0.4.6 122 1/9/2026
0.4.5 120 1/9/2026
0.4.4 123 1/9/2026

Release 0.4.16 - Fixed enum serialization to use JsonStringEnumMemberName for proper System.Text.Json deserialization