VOOZH about

URL: https://www.nuget.org/packages/uSignIn.CommonSettings

⇱ NuGet Gallery | uSignIn.CommonSettings 10.0.1




uSignIn.CommonSettings 10.0.1

Prefix Reserved
dotnet add package uSignIn.CommonSettings --version 10.0.1
 
 
NuGet\Install-Package uSignIn.CommonSettings -Version 10.0.1
 
 
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="uSignIn.CommonSettings" Version="10.0.1" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="uSignIn.CommonSettings" Version="10.0.1" />
 
Directory.Packages.props
<PackageReference Include="uSignIn.CommonSettings" />
 
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 uSignIn.CommonSettings --version 10.0.1
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: uSignIn.CommonSettings, 10.0.1"
 
 
#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 uSignIn.CommonSettings@10.0.1
 
 
#: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=uSignIn.CommonSettings&version=10.0.1
 
Install as a Cake Addin
#tool nuget:?package=uSignIn.CommonSettings&version=10.0.1
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

uSignIn.CommonSettings

👁 NuGet
👁 GitHub

uSignIn.CommonSettings is a robust C# class library designed to centralize configuration management and provide essential validation logic for the uSignIn ecosystem. It acts as a strongly-typed wrapper around appsettings.json, ensuring consistency and safety across your projects.

Features

  • Centralized Configuration: Strongly-typed access to common settings like API URLs, frontend endpoints, and platform-specific configurations (Android/iOS).
  • Request Freshness Validation: Built-in logic to validate request timestamps, helping to prevent replay attacks by enforcing a configurable time window.
  • History Tracking: Generic History<T> DTOs and extensions to easily track and retrieve the latest values from a time-ordered sequence.
  • Platform Support: dedicated configuration sections for Android and iOS specific settings (Scheme, Host).

Installation

Install the NuGet package via the .NET CLI:

dotnet add package uSignIn.CommonSettings

Or via the NuGet Package Manager in Visual Studio.

Configuration

Add the following Settings section to your appsettings.json. Adjust the values to match your environment.

{
 "Settings": {
 "BaseUrl": "https://api.yourdomain.com",
 "FrontendUrl": "https://app.yourdomain.com",
 "RequestTimeSpanRangeInMilliseconds": "-120000:120000",
 "Android": {
 "Scheme": "usignin",
 "Host": "callback"
 },
 "iOS": {
 "Scheme": "usignin",
 "Host": "callback"
 }
 }
}

Configuration Breakdown

  • BaseUrl: The root URL for your backend API.
  • FrontendUrl: The root URL for your frontend application.
  • RequestTimeSpanRangeInMilliseconds: Defines the valid time window for requests relative to the server time.
    • Format: "LowerLimit:UpperLimit" (in milliseconds).
    • Example "-120000:120000" means a request timestamp is valid if it is between 2 minutes in the past and 2 minutes in the future.
  • Android / iOS: Platform-specific settings used for deep linking or redirects.

Usage

1. Settings Service

Register the service in your Dependency Injection container (if not already handled by a startup extension) and inject SettingsService into your classes.

using uSignIn.CommonSettings.Settings;

public class MyService
{
 private readonly SettingsService _settings;

 public MyService(SettingsService settings)
 {
 _settings = settings;
 }

 public void DoWork()
 {
 // Access URLs
 var apiUrl = _settings.BaseUri;
 
 // Access Platform Settings
 var androidScheme = _settings.Android.Scheme;
 }

 public void ValidateRequest(DateTimeOffset requestTime)
 {
 // Check if the request is within the allowed time window
 if (!_settings.IsFresh(requestTime))
 {
 throw new Exception("Request is expired or invalid.");
 }
 }
}

2. History Tracking

Use the History<T> DTO and HistoryExtensions to manage historical data.

using uSignIn.CommonSettings.DTOs;

var loginHistory = new List<History<string>>
{
 new History<string> { Value = "Login_Attempt_1", TimeStamp = DateTimeOffset.UtcNow.AddMinutes(-10) },
 new History<string> { Value = "Login_Success", TimeStamp = DateTimeOffset.UtcNow }
};

// Get the value of the most recent entry
string? latestStatus = loginHistory.LatestValue(); // Returns "Login_Success"

// Get the entire latest record
History<string>? latestRecord = loginHistory.LatestRecord();

Contributing

We welcome contributions! If you find a bug or have an idea for improvement, please submit an issue or a pull request on our GitHub repository.

License

This project is licensed under the GNU GENERAL PUBLIC LICENSE.

Happy coding! 🚀🌐📚

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

Showing the top 2 NuGet packages that depend on uSignIn.CommonSettings:

Package Downloads
SMSwitch

Package Description

EmailSwitch

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.1 262 11/24/2025
10.0.0 205 11/24/2025
5.0.1 230 11/9/2025
5.0.0 359 4/12/2025
4.0.3 385 2/17/2025
4.0.2 239 1/30/2025
4.0.1 162 1/30/2025
4.0.0 205 1/8/2025
3.1.0 302 8/7/2024
3.0.0 167 8/6/2024
2.1.0 405 7/21/2024
2.0.0 285 7/21/2024
1.0.0 208 7/21/2024