ProMilesV5.SharedOps 1.3.4

There is a newer version of this package available.
See the version list below for details.
Install-Package ProMilesV5.SharedOps -Version 1.3.4
dotnet add package ProMilesV5.SharedOps --version 1.3.4
<PackageReference Include="ProMilesV5.SharedOps" Version="1.3.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ProMilesV5.SharedOps --version 1.3.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ProMilesV5.SharedOps, 1.3.4"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install ProMilesV5.SharedOps as a Cake Addin
#addin nuget:?package=ProMilesV5.SharedOps&version=1.3.4

// Install ProMilesV5.SharedOps as a Cake Tool
#tool nuget:?package=ProMilesV5.SharedOps&version=1.3.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

ProMilesV5.SharedOps

Shared .NET 8.0 class library for ProMiles projects.

Features

  • Company Services: Shared company validation and fuel tax ID operations with environment awareness
  • Claims Processing: Authentication claims parsing for application access and feature management with URL resolution
  • Environment Awareness: Automatic environment detection and URL resolution without consumer configuration
  • URL Management: Embedded URL catalog for environment-specific application URLs
  • Common Operations: Utilities and shared functionality across ProMiles applications
  • Zero Configuration: Consumer apps only need to register services - no URL configuration required
  • Docker Ready: Optimized for containerized workflows

Getting Started

Build

dotnet build

Usage

Reference this library in your .NET projects:

<ItemGroup>
  <PackageReference Include="ProMilesV5.SharedOps" Version="1.3.0" />
</ItemGroup>
Dependency Injection Setup
using ProMilesV5.SharedOps.Extensions;

// In your Program.cs or Startup.cs
// NEW: Environment-aware registration (recommended)
builder.Services.AddProMilesV5SharedOps(new Uri("https://your-api-base-url.com"));

// LEGACY: Original registration (still supported)
// builder.Services.AddSharedOpsServices(new Uri("https://your-api-base-url.com"));

Claims Processing

The library provides comprehensive claims processing functionality for client applications to parse authentication claims and extract application access and feature information.

Key Components

  • AuthClaimsUtility: Static utility class for parsing claims
  • IClaimsService: Service interface for dependency injection
  • ClaimsService: Service implementation with comprehensive claims processing and URL resolution
  • IdentityInformation: Convenience container for parsed claims data
  • IAppUrlResolver: Service for resolving environment-specific application URLs
  • IEnvironmentResolver: Service for environment detection and normalization

Models

  • FeatureAccessDto: Represents feature access claims
  • FeatureValueDto: Represents feature value claims
  • ResolvedFeature: Represents resolved features with precedence
  • IdentityInformation: Complete parsed claims container
  • ClaimsProcessingResult: Legacy result container for claims processing
  • RegistrationData: User registration data extracted from claims
  • SharedOpsEnvironment: Enum representing normalized environment types

Environment Awareness

The library automatically detects the current environment and resolves application URLs accordingly. No consumer configuration is required.

Environment Detection

The library normalizes environment names as follows:

  • dev, developmentDevelopment
  • betaBeta
  • stage, stagingStaging
  • All others → Production

URL Resolution

Application URLs are automatically resolved based on the current environment using an embedded catalog:

// Get applications with their URLs
var appsWithUrls = claimsService.GetApplicationAccessWithURL(user);
// Returns: { "FTO": "https://fto.promiles.com", "PMO": "https://pmo.promiles.com" }

Supported Applications

The embedded URL catalog includes URLs for:

  • FTO: Fuel Tax Online
  • PMO: ProMiles Online
  • DM: Driver Management
  • FLEET: Fleet Management
  • REPORTS: Reporting System

Usage Examples

Basic Claims Processing
using ProMilesV5.SharedOps.Services;
using ProMilesV5.SharedOps.Utilities;

// Using the service (recommended for DI)
var claimsService = serviceProvider.GetRequiredService<IClaimsService>();
var identityInfo = claimsService.CreateIdentityInformation(user, companyId);

// Get applications with their URLs (NEW)
var appsWithUrls = claimsService.GetApplicationAccessWithURL(user);
// Returns: { "FTO": "https://fto.promiles.com", "PMO": "https://pmo.promiles.com" }

// Using the utility directly
var apps = AuthClaimsUtility.GetApps(user);
var features = AuthClaimsUtility.GetRelevantFeatureValuesForCompany(user, companyId);
Working with IdentityInformation
var identityInfo = claimsService.CreateIdentityInformation(user, companyId);

// Access application list
foreach (var app in identityInfo.ApplicationAccess)
{
    Console.WriteLine($"User has access to: {app}");
}

// Check specific features
if (identityInfo.HasFeature("AdvancedReporting", "Enabled"))
{
    // Enable advanced reporting features
}

// Access all resolved features
foreach (var feature in identityInfo.FeaturesForCompany)
{
    Console.WriteLine($"Feature: {feature.Role}, Value: {feature.Value}");
}
Comprehensive Claims Processing

For applications that need comprehensive claims processing with registration data:

using ProMilesV5.SharedOps.Services;
using ProMilesV5.SharedOps.Models.Claims;

// Using the claims service for comprehensive processing
var claimsService = serviceProvider.GetRequiredService<IClaimsService>();
var result = claimsService.ProcessClaims(claims);

// Access results
foreach (var app in result.ApplicationAccess)
{
    Console.WriteLine($"User has access to: {app}");
}

foreach (var feature in result.ResellerFeatures)
{
    Console.WriteLine($"Feature: {feature.Key}, Value: {feature.Value}");
}

// Access registration data
var regData = result.RegistrationData;
Console.WriteLine($"User: {regData.FirstName} {regData.LastName}");
Console.WriteLine($"Company: {regData.Company}");

Claims Structure

The library expects claims in the following format:

Role Claims
  • Type: ClaimTypes.Role
  • Value: Application name (e.g., "App1", "App2")
Feature Access Claims
  • Type: "FeatureAccess"
  • Value: JSON object with role, assigned, and companyId properties
Feature Value Claims
  • Type: "FeatureValue"
  • Value: JSON object with role, value, companyId, and scope properties

Assignment Precedence

Features are resolved with the following precedence order:

  1. User - User-specific assignments
  2. Company - Company-specific assignments (exact company ID match)
  3. All Users - Global user assignments
  4. App - Application-level assignments

Configuration

  • Place your settings in appsettings.json, appsettings.Development.json, or appsettings.Beta.json as needed.
  • Files are copied to output automatically.

Docker

Build the Docker image:

docker build -t promilesv5-sharedops .

Development

  • Target Framework: .NET 8.0
  • Nullable enabled, implicit usings enabled

Authors

ProMiles

License

[Specify your license here]

NuGet packages

This package is not used by any NuGet packages.

Version Downloads Last updated
1.4.23 0 10/22/2025
1.4.22 0 10/17/2025
1.4.21 0 10/17/2025
1.4.20 0 10/17/2025
1.4.19 0 10/16/2025
1.4.18 0 10/16/2025
1.4.17 0 10/16/2025
1.4.16 0 10/16/2025
1.4.14 0 10/16/2025
1.4.12 0 10/16/2025
1.4.11 0 10/15/2025
1.4.10 0 10/15/2025
1.4.8 0 10/15/2025
1.4.7 0 10/15/2025
1.4.6 0 10/15/2025
1.4.5 0 10/15/2025
1.4.4 0 10/15/2025
1.4.3 0 10/15/2025
1.4.2 0 10/15/2025
1.4.1 0 10/10/2025
1.4.0 0 10/10/2025
1.3.8 0 10/3/2025
1.3.7 0 10/3/2025
1.3.6 0 10/3/2025
1.3.5 0 10/2/2025
1.3.4 0 10/2/2025
1.3.3 0 10/2/2025
1.3.2 0 10/2/2025
1.3.0 0 9/18/2025
1.2.7 0 9/18/2025
1.2.6 0 9/18/2025
1.2.5 0 9/18/2025
1.2.3 0 9/17/2025

See CHANGELOG.md for detailed release notes