Filippo D'Errigo Ideas, notes & experiments
Source Code Live

Pdnd Test Client

C# .NET 9 JWT firmato RSA OAuth2 client_credentials
Pdnd Test Client
Source code github.com/fderrigo/ClientTestUseCasePDND

A console application in .NET 9 designed to test interoperability with the PDND — Piattaforma Digitale Nazionale Dati (the National Digital Data Platform), the infrastructure that allows Italian public administrations to exchange data through APIs.

The project implements, in a streamlined way, the authentication and invocation flow required by PDND: building the client assertion, requesting the OAuth2 voucher, and calling the target e-service.

What it does

  1. Builds a signed client assertion

    It loads an RSA key from a .pfx certificate and generates a signed JWT with the claims required by PDND, including purposeId and iss / sub set to the client ID.

  2. Requests the PDND voucher

    It sends the client assertion to the authorization endpoint using the client_credentials grant type and receives an access token in response, that is, the voucher used to access the e-service.

  3. Calls the e-service

    It uses the voucher as a Bearer token to call the target service's API, logging the entire HTTP exchange so you can analyze the request, response, headers, and payload.

Technical details

Configuration is externalized in appsettings.json: endpoint, client ID, purpose ID, and certificate path are kept separate from the application code.

Secrets, certificates, and private keys are kept out of version control.

A custom HTTP handler intercepts and logs inbound and outbound traffic, masking the authorization token. This makes it possible to debug the flow without exposing sensitive credentials in the logs.

Why it's interesting

The project shows, without heavy frameworks or unnecessary abstractions, how to connect to a real public infrastructure.

The point is not to hide the complexity, but to make it readable: the signed JWT, the OAuth2 voucher, the HTTP call to the e-service, and traffic logging are highlighted step by step.

It is a practical reference for understanding what really happens when a client application authenticates with PDND and consumes a service exposed through the platform.


Share
Back to the Lab