Wisp.Extensions.Identity.OpenId 0.0.1

dotnet add package Wisp.Extensions.Identity.OpenId --version 0.0.1
                    
NuGet\Install-Package Wisp.Extensions.Identity.OpenId -Version 0.0.1
                    
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="Wisp.Extensions.Identity.OpenId" Version="0.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Wisp.Extensions.Identity.OpenId" Version="0.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Wisp.Extensions.Identity.OpenId" />
                    
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 Wisp.Extensions.Identity.OpenId --version 0.0.1
                    
#r "nuget: Wisp.Extensions.Identity.OpenId, 0.0.1"
                    
#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 Wisp.Extensions.Identity.OpenId@0.0.1
                    
#: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=Wisp.Extensions.Identity.OpenId&version=0.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Wisp.Extensions.Identity.OpenId&version=0.0.1
                    
Install as a Cake Tool

Wisp.Extensions.Identity.OpenId

This Wisp extension adds support for OIDC authentication to wisp. You only need to point it to an OIDC-compliant provider and set the client name and secret. The extension takes care of everything else.

Installation

To install this extension, run:

dotnet add package Wisp.Extensions.Identity.OpenId

or add the following to your csproj

<ItemGroup>
    <PackageReference Include="Wisp.Extensions.Identity.OpenId" Version="<latest_version>" />
</ItemGroup>

please consult the NuGet Package Website for the latest version.

Enabling

To add OpenID to your Wisp project, add the following code to your Program.cs:

var hostBuilder = new WispHostBuilder();

hostBuilder.AddOpenIdConnect(config => 
{
    // You can either get configuration from a config file section
    // {
    //   "Wisp": {
    //     "Extensions": {
    //       "Identity" : {
    //         "OpenId": {
    //           "DiscoveryUrl": "http://localhost:8080/realms/master/.well-known/openid-configuration",
    //           "ClientId": "wisp_demo",
    //           "ClientSecret": "qF6LD3s2qORlIqCEB9LlP1mwuNEReqaa",
    //           "Scopes": "profile openid email"
    //         }
    //       }
    //     }
    //   }
    // }
    var configSection = hostBuilder.Configuration.GetSection("Wisp:Extensions:Identity:OpenId");
    config.FromConfig(configSection);
    
    // or configure things locally
    // config
    //   .SetSuccessRedirectUri("/")
    //   .SetErrorRedirectUri("/")
    //   .SetAuthUrl("/auth/oidc/authenticate")
    //   .SetCallbackUrl("/auth/oidc/callback")
    //   .SetLogoutUrl("/auth/oidc/logout")
    //   .SetDiscoveryUrl("https://oidc-provider.example.com/.well-known/openid-confiuration")
    //   .SetClientId("wisp_demo")
    //   .SetClientSecret("this_is_a_secret")
    //   .SetScopes("openid profile email");
        
    
    config.SetUsernameField(u => u.PreferredUsername);
    config.SetRolesClaimName("roles");
});

var appBuilder = hostBuilder.Build();

appBuilder.MapOpenIdConnect();

var app = appBuilder.Build();

await app.RunAsync();

DiscoveryUrl, ClientId, ClientSecret and Scopes are required, the rest of the config has sensible default that should work out of the box (see below for details).

Configuration

This is a list of available configuration keys and default values

Configuration Description Required Default
DiscoveryUrl URL of the OIDC discovery document Yes
ClientId The OpenID Client ID Yes
ClientSecret The OpenID Client Secret Yes
Scopes List of required OpenID Scopes Yes
RolesClaimName The name of the 'roles' claim No roles
SuccessRedirectUri Where the user will be redirected if the auth succeeds No /
ErroRedirectUri Where the user fill be redirected if the auth fails No /
AuthUrl The route that will initiate IODC authentication No /auth/oidc/authenticate
CallbackUrl The route of the OIDC callback No /auth/oidc/callback
LogoutUrl The route that will delete the user's session No /auth/oidc/logout
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.1 171 8/30/2025