Nabs.Launchpad.Core.Portal
9.0.145
Prefix Reserved
See the version list below for details.
dotnet add package Nabs.Launchpad.Core.Portal --version 9.0.145
NuGet\Install-Package Nabs.Launchpad.Core.Portal -Version 9.0.145
<PackageReference Include="Nabs.Launchpad.Core.Portal" Version="9.0.145" />
<PackageVersion Include="Nabs.Launchpad.Core.Portal" Version="9.0.145" />
<PackageReference Include="Nabs.Launchpad.Core.Portal" />
paket add Nabs.Launchpad.Core.Portal --version 9.0.145
#r "nuget: Nabs.Launchpad.Core.Portal, 9.0.145"
#:package Nabs.Launchpad.Core.Portal@9.0.145
#addin nuget:?package=Nabs.Launchpad.Core.Portal&version=9.0.145
#tool nuget:?package=Nabs.Launchpad.Core.Portal&version=9.0.145
Nabs Launchpad Core Portal Library
A comprehensive .NET 9 library for building Blazor Server portal applications with authentication, user context management, and service configuration.
Overview
The Nabs.Launchpad.Core.Portal
library provides essential infrastructure for creating enterprise-grade Blazor Server portal applications. It includes JWT authentication, user context management, middleware pipeline configuration, and service registration helpers.
Features
- Blazor Server Components: Pre-configured setup for interactive server-side Blazor applications
- JWT Authentication: Complete JWT Bearer token authentication with configurable options
- User Context Management: Automatic user context creation and injection from HTTP context
- Middleware Pipeline: Built-in middleware for user context extraction and management
- Localization Support: Multi-culture support with en-NZ, en-US, af, and mi locales
- Service Defaults Integration: Seamless integration with Nabs.Launchpad.Core.ServiceDefaults
- Portal Context: Configurable portal settings and base path support
- MVVM Messaging: Integrated CommunityToolkit.Mvvm messaging support
Dependencies
This library depends on:
Nabs.Launchpad.Core.Context
- User and portal context definitionsNabs.Launchpad.Core.Interfaces
- Core interfaces and contractsNabs.Launchpad.Core.ServiceDefaults
- Default service configurationsNabs.Launchpad.Ui.Shell
- UI shell components and layoutsMicrosoft.AspNetCore.Authentication.JwtBearer
- JWT authentication support
Installation
dotnet add package Nabs.Launchpad.Core.Portal
Quick Start
1. Configure Portal Services
var builder = WebApplication.CreateBuilder(args);
builder.AddPortalServices(options =>
{
options.PortalName = "My Portal";
options.PortalContext = new PortalContext
{
PortalBasePath = "/myportal"
};
options.AdditionalAssemblies = [typeof(MyComponent).Assembly];
options.DisableAuth = false; // Enable authentication
options.AuthIssuer = "https://myauth.example.com";
options.AuthAudience = "my-portal-audience";
options.AuthKey = "your-secret-key-here";
});
2. Configure Portal Application
var app = builder.Build();
app.UsePortalServices<App>(); // App is your root Blazor component
app.Run();
Configuration Options
PortalServiceOptions
Property | Type | Description | Default |
---|---|---|---|
PortalName |
string |
Display name for the portal | "" |
PortalContext |
PortalContext |
Portal configuration settings | new() |
AdditionalAssemblies |
Assembly[] |
Additional assemblies for Blazor components | [] |
DisableAuth |
bool |
Disable authentication completely | false |
AuthIssuer |
string |
JWT token issuer | "AuthIssuer" |
AuthAudience |
string |
JWT token audience | "AuthAudience" |
AuthKey |
string |
JWT signing key | Default secure key |
User Context
The library automatically creates and manages user context from authenticated HTTP requests:
public class MyComponent : ComponentBase
{
[Inject] public UserContext UserContext { get; set; } = default!;
protected override void OnInitialized()
{
if (UserContext.IsAuthenticated)
{
var userName = UserContext.DisplayName;
var email = UserContext.Email;
var objectId = UserContext.ObjectId;
}
}
}
Middleware Pipeline
The library configures the following middleware pipeline:
- HTTPS Redirection
- Exception Handling (non-development)
- Authentication & Authorization (if enabled)
- User Context Middleware
- Static Files & Assets
- Antiforgery
- Request Localization
- Blazor Hub & Components
Localization
Built-in support for multiple cultures:
en-NZ
(default)en-US
af
(Afrikaans)mi
(M?ori)
Path Base Support
Configure custom base paths for portal deployment:
options.PortalContext = new PortalContext
{
PortalBasePath = "/admin" // Portal accessible at /admin
};
Authentication Claims
The library extracts the following claims from JWT tokens:
name
- Display nameemail
/preferred_username
- Email addressoid
- Object identifier
Development vs Production
- Development: Detailed errors enabled, exception page used
- Production: Generic error page, HSTS enabled
Examples
Minimal Portal Setup
var builder = WebApplication.CreateBuilder(args);
builder.AddPortalServices(options =>
{
options.PortalName = "Simple Portal";
options.DisableAuth = true; // For development
});
var app = builder.Build();
app.UsePortalServices<App>();
app.Run();
Enterprise Portal with Authentication
var builder = WebApplication.CreateBuilder(args);
builder.AddPortalServices(options =>
{
options.PortalName = "Enterprise Portal";
options.PortalContext = new PortalContext
{
PortalBasePath = "/enterprise"
};
options.AuthIssuer = builder.Configuration["Auth:Issuer"];
options.AuthAudience = builder.Configuration["Auth:Audience"];
options.AuthKey = builder.Configuration["Auth:SigningKey"];
options.AdditionalAssemblies = [
typeof(EnterpriseComponents.Dashboard).Assembly,
typeof(ReportingComponents.Reports).Assembly
];
});
var app = builder.Build();
app.UsePortalServices<App>();
app.Run();
Contributing
This library is part of the Nabs Launchpad framework. For contributing guidelines, please refer to the main repository documentation.
License
Copyright � Net Advantage Business Solutions. All rights reserved.
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
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 9.0.7)
- Nabs.Launchpad.Core.Context (>= 9.0.145)
- Nabs.Launchpad.Core.Interfaces (>= 9.0.145)
- Nabs.Launchpad.Core.ServiceDefaults (>= 9.0.145)
- Nabs.Launchpad.Ui.Shell (>= 9.0.145)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.