VOOZH about

URL: https://www.nuget.org/packages/Energinet.DataHub.MarketParticipant.Authorizations.Client/

⇱ NuGet Gallery | Energinet.DataHub.MarketParticipant.Authorizations.Client 1.0.517




Energinet.DataHub.MarketParticipant.Authorizations.Client 1.0.517

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

Authorizations Client

.NET client package for the Authorizations API (v1).

Installation

dotnet add package Energinet.DataHub.MarketParticipant.Authorizations.Client

Registration

Register the client in your dependency injection container using one of the two available overloads.

Using the ambient IConfiguration (recommended)

Reads options from the IConfiguration already registered in the DI container:

services.AddAuthorizationClient();

Using an explicit IConfiguration instance

Useful when you want to pass a specific configuration object:

services.AddAuthorizationClient(configuration);

Both overloads register AuthorizationsClient as a typed HttpClient and validate the options at startup.

Configuration

Options are bound from the AuthorizationClient section of your configuration (e.g. appsettings.json):

{
 "AuthorizationClient": {
 "BaseUrl": "https://authorizations.example.com"
 }
}

Options

Option Type Required Default Description
BaseUrl Uri Yes Absolute base URL of the Authorizations API. Must be an absolute URI.

HTTP timeout behavior is configured through the AuthorizationsHttpClientResilience section.

Resilience options

The client uses AddStandardResilienceHandler() and binds HttpStandardResilienceOptions from the AuthorizationsHttpClientResilience section.

The effective resilience settings are built by merging:

  1. Internal defaults from the client package.
  2. Values from your AuthorizationsHttpClientResilience configuration section.

This means you can provide only the values you want to override.

Default resilience values
Path Default
AuthorizationsHttpClientResilience:Retry:Delay 00:00:02
AuthorizationsHttpClientResilience:Retry:BackoffType Exponential
AuthorizationsHttpClientResilience:Retry:MaxRetryAttempts 4
AuthorizationsHttpClientResilience:Retry:UseJitter true
Example override
{
 "AuthorizationsHttpClientResilience": {
 "Retry": {
 "MaxRetryAttempts": 7,
 "Delay": "00:00:05"
 }
 }
}

In this example, BackoffType and UseJitter still come from the defaults.

Usage

This client supports two primary usage patterns:

1. Getting Authorization Tokens (Origin System)

Retrieve an AuthorizationContext that can be passed to downstream systems:

public class AuthorizationTokenService(AuthorizationsClient client)
{
 public async Task<AuthorizationContext> GetTokenForSubjectAsync(Guid subjectId, CancellationToken ct = default)
 {
 return await client.AuthorizationContextForSubjectAsync(subjectId, ct);
 }

 public async Task<AuthorizationContext> GetTokenForActorAsync(string gln, MarketRoles role, CancellationToken ct = default)
 {
 return await client.AuthorizationContextForActorAsync(gln, role, ct);
 }
}

The returned AuthorizationContext contains the token (signature) and claims, which should be transmitted to downstream systems.

2. Validating Tokens & Extracting Policies (Downstream System)

Use PolicyFactory to validate an incoming AuthorizationContext and resolve policies:

public class AuthorizationService(PolicyFactory policyFactory)
{
 public async Task<MeteringPointAccessPolicy> ValidateAndGetPolicyAsync(
 AuthorizationContext context, 
 CancellationToken ct = default)
 {
 return await policyFactory.GetPolicy<MeteringPointAccessPolicy>(context, ct);
 }
}

The PolicyFactory will:

  • Retrieve the public key from the provider
  • Validate the authorization context signature
  • Extract and return the strongly-typed policy

If validation fails, an InvalidOperationException is thrown.

Testing Environment

For testing scenarios where signature verification should be bypassed, register the test double after the main client registration:

public void ConfigureServices(IServiceCollection services)
{
 services
 .AddAuthorizationClient(configuration)
 .AddBypassSignatureVerificationForTesting();
}

This substitutes the standard key provider with one that accepts all signatures, allowing you to focus on business logic validation without dealing with cryptographic concerns.

⚠️ Never use in production — this is test-only functionality.

A context can be created with AuthorizationContextBuilder for testing purposes:

 var context = var policy = AuthorizationContextBuilder.Create()
 .WithMeteringPointAccess("mp-1", MeteringPointSubjectRelation.Occupancy, TestTime.AddDays(-1), TestTime.AddDays(1))
 .WithMeteringPointAccess("mp-2", MeteringPointSubjectRelation.Occupancy, TestTime.AddDays(-1), TestTime.AddDays(1))
 .BuildContext();

If needed, you can then pass this context to the PolicyFactory to get a policy instance for testing:

 var policy = await BypassSignaturePolicyFactory.Instance
 .GetPolicy<MeteringPointAccessPolicy>(context, CancellationToken.None);

For maintainers

How this package is published

The client code in this project is automatically generated from the file-based OpenAPI contract at ../Energinet.DataHub.MarketParticipant.Authorizations.Api/OpenApi/Energinet.DataHub.MarketParticipant.Authorizations.Api.json (via NSwag). You never edit AuthorizationsClient.g.cs by hand.

The contract file is produced by building Energinet.DataHub.MarketParticipant.Authorizations.Api (code-first controllers + OpenAPI generation).

When you build the client and the contract file is missing, an MSBuild bootstrap target in the client automatically builds the API first to generate the contract file.

Typical local flow:

  1. Build the API project to refresh the OpenAPI contract file.
  2. Build the client project to regenerate AuthorizationsClient.g.cs from that contract.

Publishing is handled by the CI workflow .github/workflows/publish-authorizations-client-bundle.yml. It triggers automatically when any file under Authorizations.Api/ or Authorizations.Client/ is merged to main, and:

  1. Builds the full Authorizations solution (which regenerates the OpenAPI contract and then regenerates the client from that file contract).
  2. Runs unit tests.
  3. Packs and pushes the NuGet package.

You do not need to do anything manually to publish a new version.

Versioning

Versioning is handled automatically by Nerdbank.GitVersioning. The published version is derived from the base version in version.json combined with the git commit height (number of commits on main since the repo root):

Branch Example version Published to NuGet?
main 1.0.42 Yes
feature branch 1.0.42-gabcdef1 No (pre-release)

When to edit version.json

version.json only needs to be edited for intentional breaking or significant changes that warrant a major or minor version bump. The patch number is always automatic.

Scenario Action
Add/change/remove an API endpoint — backwards compatible Do nothing. Patch auto-increments on merge.
Add/change/remove an API endpoint — breaking change Bump minor (e.g. 1.01.1) or major (e.g. 1.02.0) in version.json.
Accidental version conflict (e.g. rolling back version.json) The pre-merge version guard workflow will catch this and fail the PR.

To bump, open version.json and change the version field:

{
 "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
 "version": "2.0",
 "publicReleaseRefSpec": [
 "^refs/heads/main$"
 ]
}

Note: A PR that changes version.json will automatically trigger the version guard workflow (.github/workflows/ci-authorizations-client-version-guard.yml), which queries NuGet.org and fails the PR if the major.minor combination is already in use.

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 (1)

Showing the top 1 NuGet packages that depend on Energinet.DataHub.MarketParticipant.Authorizations.Client:

Package Downloads
Energinet.DataHub.Measurements.Client

[Release Notes](https://github.com/Energinet-DataHub/opengeh-measurements/blob/main/docs/Measurements.Client/ReleaseNotes/ReleaseNotes.md) [Documentation](https://github.com/Energinet-DataHub/opengeh-measurements/blob/main/docs/Measurements.Client/Documentation.md)

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.517 0 6/18/2026
1.0.511 0 6/18/2026
1.0.510 0 6/18/2026
1.0.506 0 6/18/2026
1.0.504 6 6/18/2026
1.0.502 39 6/18/2026
1.0.495 47 6/17/2026
1.0.493 47 6/17/2026
1.0.492 39 6/17/2026
1.0.488 47 6/17/2026
1.0.482 95 6/16/2026
1.0.480 45 6/16/2026
1.0.475 203 6/15/2026
1.0.474 88 6/15/2026
1.0.472 90 6/15/2026
1.0.470 92 6/15/2026
1.0.466 86 6/15/2026
1.0.464 439 6/12/2026
1.0.459 95 6/11/2026
1.0.456 97 6/11/2026
Loading failed