Purlin.CentralAuth.Integration
1.0.1
Prefix Reserved
See the version list below for details.
dotnet add package Purlin.CentralAuth.Integration --version 1.0.1
NuGet\Install-Package Purlin.CentralAuth.Integration -Version 1.0.1
<PackageReference Include="Purlin.CentralAuth.Integration" Version="1.0.1" />
<PackageVersion Include="Purlin.CentralAuth.Integration" Version="1.0.1" />
<PackageReference Include="Purlin.CentralAuth.Integration" />
paket add Purlin.CentralAuth.Integration --version 1.0.1
#r "nuget: Purlin.CentralAuth.Integration, 1.0.1"
#:package Purlin.CentralAuth.Integration@1.0.1
#addin nuget:?package=Purlin.CentralAuth.Integration&version=1.0.1
#tool nuget:?package=Purlin.CentralAuth.Integration&version=1.0.1
Purlin.CentralAuth.Integration
Purlin.CentralAuth.Integration provides a lightweight and extensible way to integrate with the Central Auth service 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.Integration
🛠️ Configuration
Start by defining your authentication and caching settings:
var integrationUrl = "https://auth-integration.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.AddCentralAuthIntegrationServices(authSettings, integrationApiBaseUrl);
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
TokenCachingMethodis set to Redis, theRedisSettingssection 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 | Versions 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 was computed. 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. |
-
net8.0
- Microsoft.Extensions.Caching.Memory (>= 9.0.6)
- Purlin.CentralAuth.Provider.Models (>= 1.4.3)
- Refit.HttpClientFactory (>= 7.0.0)
- StackExchange.Redis (>= 2.8.37)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.