Acontplus.Services 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Acontplus.Services --version 1.1.0
                    
NuGet\Install-Package Acontplus.Services -Version 1.1.0
                    
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="Acontplus.Services" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Acontplus.Services" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Acontplus.Services" />
                    
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 Acontplus.Services --version 1.1.0
                    
#r "nuget: Acontplus.Services, 1.1.0"
                    
#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 Acontplus.Services@1.1.0
                    
#: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=Acontplus.Services&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Acontplus.Services&version=1.1.0
                    
Install as a Cake Tool

Acontplus.Services

NuGet .NET License

A modern .NET 9+ library for API services, authentication, claims, middleware, and configuration. Includes JWT, user context, and exception handling for robust enterprise APIs.

🚀 Features

  • Platform-aware Configuration Loading - Dynamic app and shared config loading
  • Claims-based User Context Extensions - Easy access to user info and claims
  • Identity & JWT Authentication - Flexible and strict JWT setup
  • User Context Service - Abstracted access to user claims
  • Global Exception Handling Middleware - Robust error logging and API error responses
  • Mobile Request Detection Middleware - Detects mobile clients via headers

📦 Installation

NuGet Package Manager

Install-Package Acontplus.Services

.NET CLI

dotnet add package Acontplus.Services

PackageReference

<ItemGroup>
  <PackageReference Include="Acontplus.Services" Version="1.0.12" />
</ItemGroup>

🎯 Quick Start

1. Add JWT Authentication

using Microsoft.Extensions.DependencyInjection;
using Acontplus.Services.Extensions;

public void ConfigureServices(IServiceCollection services)
{
    services.AddIdentityService(Configuration); // or AddIdentityServiceStrict
}

public void Configure(IApplicationBuilder app)
{
    app.UseAuthentication();
    app.UseAuthorization();
}

2. Use ClaimsPrincipal Extensions

using System.Security.Claims;
using Acontplus.Services.Extensions;

var username = user.GetUsername();
var email = user.GetEmail();
var userId = user.GetUserId();

3. Global Exception Middleware

app.UseMiddleware<ApiExceptionMiddleware>();

🔧 Advanced Usage

AppConfiguration

using Acontplus.Services.Configuration;
var config = AppConfiguration.Load();

User Context Service

using Acontplus.Services.Extensions;
services.AddHttpContextAccessor();
services.AddScoped<IUserContext, UserContext>();

JsonConfigurationService

Centralizes and standardizes System.Text.Json options for your application.

using Acontplus.Services.Configuration;

// Get default options for serialization
var options = JsonConfigurationService.GetDefaultOptions();

// For pretty-printing (development)
var prettyOptions = JsonConfigurationService.GetPrettyOptions();

// For strict API validation
var strictOptions = JsonConfigurationService.GetStrictOptions();
Integrate with ASP.NET Core
// In Program.cs or Startup.cs
using Acontplus.Services.Configuration;

var builder = WebApplication.CreateBuilder(args);

// Use default or strict options for all controllers and minimal APIs
JsonConfigurationService.ConfigureAspNetCore(builder.Services, useStrictMode: false);

// Or, environment-aware:
JsonConfigurationService.ConfigureAspNetCore(builder.Services, builder.Environment.IsDevelopment());
Dependency Injection
// Register as singleton for DI
JsonConfigurationService.RegisterJsonConfiguration(services);

// Then inject IJsonConfigurationProvider wherever needed
public class MyService
{
    public MyService(IJsonConfigurationProvider jsonConfig) { ... }
}

📚 API Documentation

  • AppConfiguration - Platform/environment config loader
  • ClaimsPrincipalExtensions - User/claim helpers
  • ApiExceptionMiddleware - Centralized error handling
  • UserContext - User info abstraction
  • RequestContextOptions - Request context config

🤝 Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

Development Setup

git clone https://github.com/Acontplus-S-A-S/acontplus-dotnet-libs.git
cd acontplus-dotnet-libs
dotnet restore
dotnet build

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🆘 Support

  • 📧 Email: proyectos@acontplus.com
  • 🐛 Issues: GitHub Issues
  • 📖 Documentation: Wiki

👨‍💻 Author

Ivan Paz - @iferpaz7

🏢 Company

Acontplus S.A.S. - Enterprise software solutions


Built with ❤️ for the .NET community

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.

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.3.1 488 7/23/2025
1.3.0 44 7/18/2025
1.2.0 134 7/14/2025
1.1.4 131 7/14/2025
1.1.3 77 7/11/2025
1.1.2 82 7/11/2025
1.1.1 133 7/10/2025
1.1.0 134 7/10/2025
1.0.12 123 7/10/2025
1.0.11 133 7/9/2025
1.0.10 132 7/9/2025
1.0.9 131 7/6/2025
1.0.8 135 7/6/2025
1.0.7 131 7/6/2025
1.0.6 79 7/4/2025
1.0.5 137 7/2/2025
1.0.4 133 7/2/2025
1.0.3 134 7/2/2025
1.0.2 133 7/1/2025

Updated for .NET 9+ with modern C# features, improved middleware, and enhanced documentation.