Purlin.CentralAuth.Provider 1.0.7

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

Purlin.CentralAuth.Provider

NuGet

Purlin.CentralAuth.Provider provides a lightweight and extensible way to interact with a Central Auth Provider API using a familiar Refit-like experience. It includes built-in token acquisition and caching mechanisms to improve performance and reduce redundant authentication requests.


πŸš€ Features

  • Refit-like interface for making API requests
  • Built-in token acquisition using client credentials
  • Token caching strategies:
    • None – always requests a new token
    • MemoryCache – stores token in local memory
    • Redis – stores token in a shared Redis instance (ideal for distributed systems)

πŸ“¦ Installation

dotnet add package Purlin.CentralAuth.Provider

πŸ› οΈ Configuration

Start by defining your authentication and caching settings:

var providerUrl = "https://auth-provider.identity.com";

var authSettings = new AuthSettings
{
    Authority = "https://auth.identity.com",
    ClientId = "client_id",
    ClientSecret = "client_secret",

    TokenCachingMethod = TokenCacheMethodEnum.Redis, // Choose None, MemoryCache, or Redis
    RedisSettings = new RedisSettings
    {
        Endpoint = "redis_endpoint",
        Password = "redis_password",
        Database = 0
    }
};

builder.Services.AddCentralAuthProviderServices(authSettings, providerAPIBaseUrl);

Below are the available caching method descriptions:

  • None – You will need to handle all token-related operations manually through a custom DelegatingHandler.
  • MemoryCache – Ideal for systems not running behind load balancers. If using a load balancer, avoid this option to prevent inconsistent caching.
  • Redis – Recommended for load-balanced environments. Tokens are stored in a centralized Redis instance and shared across service instances. Note: When TokenCachingMethod is set to Redis, the RedisSettings section is required.

The Redis instance used won’t interfere with any existing Redis registrations. It is registered as a keyed singleton using an internal key known only to the package.

This package also allows you to configure a global timeout for all outgoing requests. By default, each request will timeout after 10 seconds, but you can customize this value if needed.

πŸ“„ Pagination Notes

All endpoints that support pagination use the following query parameters: page – the current page number (starting at 1, not 0) pageSize – the number of items to return per page

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  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.

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
1.0.7 265 9/18/2025
1.0.6 271 9/16/2025
1.0.5 276 9/16/2025
1.0.4 207 9/15/2025
1.0.3 444 7/21/2025
1.0.2 414 7/21/2025
1.0.1 135 7/6/2025
1.0.0 83 7/5/2025