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
<PackageReference Include="Wisp.Extensions.Identity.OpenId" Version="0.0.1" />
<PackageVersion Include="Wisp.Extensions.Identity.OpenId" Version="0.0.1" />
<PackageReference Include="Wisp.Extensions.Identity.OpenId" />
paket add Wisp.Extensions.Identity.OpenId --version 0.0.1
#r "nuget: Wisp.Extensions.Identity.OpenId, 0.0.1"
#:package Wisp.Extensions.Identity.OpenId@0.0.1
#addin nuget:?package=Wisp.Extensions.Identity.OpenId&version=0.0.1
#tool nuget:?package=Wisp.Extensions.Identity.OpenId&version=0.0.1
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 | Versions 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. |
-
net9.0
- System.IdentityModel.Tokens.Jwt (>= 8.14.0)
- Wisp.Framework.Core (>= 0.0.1)
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 |