.NET Integration Kit

Using the sample applications

Importing the PingFederate configuration archive

The included configuration archive creates all required adapter instances and connections in PingFederate.

  1. Sign on to the PingFederate admin console.

  2. Go to System > Server Configuration > Configuration Archive.

  3. Click Import and select the sample/data.zip file.

  4. Confirm the import.

Importing the archive overwrites your entire PingFederate configuration. Use a fresh installation or back up your existing configuration before importing. Learn more in Exporting an archive in the PingFederate documentation.

Running the sample applications

Open two terminal windows and run each application from its publish directory.

IdP sample application:

cd sample/IdpSample/publish
dotnet IdpSample.dll

Starts on https://localhost:5001.

SP sample application:

cd sample/SpSample/publish
dotnet SpSample.dll

Starts on https://localhost:5002.

If your browser shows a certificate warning, trust the .NET development certificate by running:

dotnet dev-certs https --trust

Building and running the applications from source

The sample_src/ directory contains the full source code. Each application has its own solution file and can be built and run independently.

IdP sample application:

cd sample_src
dotnet run --project IdpSample

Starts on https://localhost:5001.

SP sample application:

cd sample_src
dotnet run --project SpSample

Starts on https://localhost:5002.

The opentoken-agent.dll library referenced by both projects is included in sample_src/libs/.

IdP sample application endpoints

Parameter Method Description

/

GET, POST

Landing page. Shows authenticated user’s attributes and buttons to start SSO or SLO.

/Login

GET, POST

Local login form. Authenticates user credentials against idp_users.json. On success, calls agent.WriteToken() and redirects to PingFederate.

/Logout

GET, POST

SLO handler. Clears the local session and redirects to PingFederate SLO resume path.

/LocalLogout

GET

Clears local session and OpenToken cookie only. Doesn’t trigger PingFederate SLO.

/Config

GET, POST

Runtime configuration editor for PingFederate base URL, SP connections, and adapter instance names.

SP sample application endpoints

Parameter Method Description

/

GET, POST

Landing page. Shows attributes received from the OpenToken and buttons to start SSO or SLO.

/Login

GET, POST

Reads and validates the OpenToken from PingFederate. On success, calls SignInAsync to establish an ASP.NET Core cookie authentication session and redirects to the home page.

/AccountLinking

GET

Account linking flow for associating an incoming federated identity with a local user account.

/Logout

GET, POST

SLO handler. Clears the local session and redirects to PingFederate SLO resume path.

/LocalLogout

GET

Ends the local session and removes the SP OpenToken cookie without initiating a PingFederate SLO.

/Config

GET, POST

Runtime configuration editor for PingFederate base URL, IdP connections, and adapter instance names.

Test users

IdP application

Located in IdpSample/wwwroot/config/idp_users.json. Used at the IdP application’s /Login endpoint during SSO flows.

Username Password Email Role

joe

test

joe@example.com

admin

sarah

test

sarah@example.com

viewer

idp

test

idp@example.com

N/A

SP application

Located in SpSample/wwwroot/config/sp_users.json. Used at the SP application’s /AccountLinking endpoint during account linking flows. These credentials are only required when the SP OpenToken Adapter is configured to use account linking.

Username Password Email Role

joe

test

joe@example.com

admin

sarah

test

sarah@example.com

user

idp

test

idp@example.com

user