![]() |
VOOZH | about |
dotnet add package uSignIn.CommonSettings --version 10.0.1
NuGet\Install-Package uSignIn.CommonSettings -Version 10.0.1
<PackageReference Include="uSignIn.CommonSettings" Version="10.0.1" />
<PackageVersion Include="uSignIn.CommonSettings" Version="10.0.1" />Directory.Packages.props
<PackageReference Include="uSignIn.CommonSettings" />Project file
paket add uSignIn.CommonSettings --version 10.0.1
#r "nuget: uSignIn.CommonSettings, 10.0.1"
#:package uSignIn.CommonSettings@10.0.1
#addin nuget:?package=uSignIn.CommonSettings&version=10.0.1Install as a Cake Addin
#tool nuget:?package=uSignIn.CommonSettings&version=10.0.1Install as a Cake Tool
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.
History<T> DTOs and extensions to easily track and retrieve the latest values from a time-ordered sequence.Install the NuGet package via the .NET CLI:
dotnet add package uSignIn.CommonSettings
Or via the NuGet Package Manager in Visual Studio.
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"
}
}
}
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.
"LowerLimit:UpperLimit" (in milliseconds)."-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.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.");
}
}
}
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();
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.
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. |
Showing the top 2 NuGet packages that depend on uSignIn.CommonSettings:
| Package | Downloads |
|---|---|
|
SMSwitch
Package Description |
|
|
EmailSwitch
Package Description |
This package is not used by any popular GitHub repositories.