![]() |
VOOZH | about |
dotnet add package Energinet.DataHub.MarketParticipant.Authorizations.Client --version 1.0.517
NuGet\Install-Package Energinet.DataHub.MarketParticipant.Authorizations.Client -Version 1.0.517
<PackageReference Include="Energinet.DataHub.MarketParticipant.Authorizations.Client" Version="1.0.517" />
<PackageVersion Include="Energinet.DataHub.MarketParticipant.Authorizations.Client" Version="1.0.517" />Directory.Packages.props
<PackageReference Include="Energinet.DataHub.MarketParticipant.Authorizations.Client" />Project file
paket add Energinet.DataHub.MarketParticipant.Authorizations.Client --version 1.0.517
#r "nuget: Energinet.DataHub.MarketParticipant.Authorizations.Client, 1.0.517"
#:package Energinet.DataHub.MarketParticipant.Authorizations.Client@1.0.517
#addin nuget:?package=Energinet.DataHub.MarketParticipant.Authorizations.Client&version=1.0.517Install as a Cake Addin
#tool nuget:?package=Energinet.DataHub.MarketParticipant.Authorizations.Client&version=1.0.517Install as a Cake Tool
.NET client package for the Authorizations API (v1).
dotnet add package Energinet.DataHub.MarketParticipant.Authorizations.Client
Register the client in your dependency injection container using one of the two available overloads.
IConfiguration (recommended)Reads options from the IConfiguration already registered in the DI container:
services.AddAuthorizationClient();
IConfiguration instanceUseful 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.
Options are bound from the AuthorizationClient section of your configuration (e.g. appsettings.json):
{
"AuthorizationClient": {
"BaseUrl": "https://authorizations.example.com"
}
}
| 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.
The client uses AddStandardResilienceHandler() and binds HttpStandardResilienceOptions from the AuthorizationsHttpClientResilience section.
The effective resilience settings are built by merging:
AuthorizationsHttpClientResilience configuration section.This means you can provide only the values you want to override.
| Path | Default |
|---|---|
AuthorizationsHttpClientResilience:Retry:Delay |
00:00:02 |
AuthorizationsHttpClientResilience:Retry:BackoffType |
Exponential |
AuthorizationsHttpClientResilience:Retry:MaxRetryAttempts |
4 |
AuthorizationsHttpClientResilience:Retry:UseJitter |
true |
{
"AuthorizationsHttpClientResilience": {
"Retry": {
"MaxRetryAttempts": 7,
"Delay": "00:00:05"
}
}
}
In this example, BackoffType and UseJitter still come from the defaults.
This client supports two primary usage patterns:
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.
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:
If validation fails, an InvalidOperationException is thrown.
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);
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:
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:
You do not need to do anything manually to publish a new version.
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) |
version.jsonversion.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.0 → 1.1) or major (e.g. 1.0 → 2.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.jsonwill automatically trigger the version guard workflow (.github/workflows/ci-authorizations-client-version-guard.yml), which queries NuGet.org and fails the PR if themajor.minorcombination 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. |
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) |
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 |