Skip to content

Example Projects

The examples solution includes web application projects demonstrating SAML SSO, as well as supporting console application projects.

All projects should build cleanly without any errors or warnings.

Tip

As a starting point, it's recommended that the ExampleIdentityProvider and ExampleServiceProvider projects are both run in the Visual Studio debugger to see SAML SSO in action.

Single Sign-On (SSO)

The projects under the SSO folder demonstrate acting either as the SAML Identity Provider (IdP) or SAML Service Provider (SP).

ExampleIdentityProvider + ExampleServiceProvider

  • Built using the standard Visual Studio ASP.NET Core Web App template.
  • Local authentication uses individual accounts.
  • Demonstrates calling the SAML API.
  • Run both projects in the Visual Studio debugger to see SAML SSO in action.

MiddlewareIdentityProvider + MiddlewareServiceProvider

  • Built using the standard Visual Studio ASP.NET Core Web App template.
  • Local authentication uses individual accounts.
  • Demonstrates using the SAML middleware and SAML authentication handler rather than calling the SAML API.
  • Run both projects in the Visual Studio debugger to see SAML SSO in action.

BlazorIdentityProvider + BlazorServiceProvider

  • Built using the standard Visual Studio Blazor Web App template.
  • Local authentication uses individual accounts.
  • Demonstrates calling the SAML API.
  • Run both projects in the Visual Studio debugger to see SAML SSO in action.

CookieIdentityProvider + CookieServiceProvider

  • Built using the standard Visual Studio ASP.NET Core Web App template.
  • Local authentication uses cookies.
  • Demonstrates using the SAML middleware and SAML authentication handler rather than calling the SAML API.
  • Run both projects in the Visual Studio debugger to see SAML SSO in action.

DatabaseIdentityProvider + DatabaseServiceProvider

  • Built using the standard Visual Studio ASP.NET Core Web App template.
  • Local authentication uses cookies.
  • Demonstrates SAML configuration stored in an Entity Framework database.
  • Run both projects in the Visual Studio debugger to see SAML SSO in action.

ExampleWebApi

  • Built using the standard Visual Studio ASP.NET Core Web API template.
  • Demonstrates calling the SAML API for authentication and using JWT bearer tokens for authorization.
  • Acts as a SP on behalf of a front-end app.

SamlProxy

  • Built using the standard Visual Studio ASP.NET Core Web App template.
  • Demonstrates acting as a proxy between IdPs and SPs.

Certificate

CreateSelfSignedCert

  • Creates a self-signed X.509 certificate.
  • The certificate may be specified as the local certificate in the SAML configuration.

ValidateCert

  • Validates an X.509 certificate including checking whether it's expired.

Configuration

CreateConfiguration

  • Prompts for information to create a SAML configuration.

Encryption

Decrypt

  • Decrypts SAML assertions, attributes and IDs.

Encrypt

  • Encrypts SAML assertions, attributes and IDs.

Metadata

CreateMetadata

  • Prompts for information to create SAML metadata to share with a partner entity.

ExportMetadata

  • Exports SAML configuration as SAML metadata.

ImportMetadata

  • Imports SAML metadata into SAML configuration.

ManageMetadataUpdates

  • Demonstrates a simple database used to manage SAML metadata updates.

Signature

GenerateSignature

  • Generates XML signatures on SAML assertions, messages and metadata.

VerifySignature

  • Verifies XML signatures on SAML assertions, messages and metadata.

Utility

ValidateAgainstSchema

  • Validates SAML message, assertion and metadata XML against the SAML XML schemas.

SetupSAML

  • Sets up local SAML configuration, generates local SAML metadata and imports partner SAML metadata.
  • Useful for the initial SAML configuration setup.