Identity.Base.Organizations
0.5.1
See the version list below for details.
dotnet add package Identity.Base.Organizations --version 0.5.1
NuGet\Install-Package Identity.Base.Organizations -Version 0.5.1
<PackageReference Include="Identity.Base.Organizations" Version="0.5.1" />
<PackageVersion Include="Identity.Base.Organizations" Version="0.5.1" />
<PackageReference Include="Identity.Base.Organizations" />
paket add Identity.Base.Organizations --version 0.5.1
#r "nuget: Identity.Base.Organizations, 0.5.1"
#:package Identity.Base.Organizations@0.5.1
#addin nuget:?package=Identity.Base.Organizations&version=0.5.1
#tool nuget:?package=Identity.Base.Organizations&version=0.5.1
Identity Base Organizations
Identity.Base.Organizations layers organization management on top of the core Identity Base and RBAC packages. It provides EF Core entities, services, hosted infrastructure, and minimal API endpoints so any host can manage organizations, memberships, and organization-scoped roles without custom scaffolding.
Features
- Organization aggregate (
Organization,OrganizationMetadata) with per-tenant slug/display name uniqueness. - Membership service with primary-organization tracking, role assignments, and helper queries for listing memberships.
- Organization-specific role catalog and claim formatter that augments Identity Base permission claims with organization context.
- Hosted migration/seed services that keep the organizations schema current and bootstrap default roles (
OrgOwner,OrgManager,OrgMember). - Minimal API modules for CRUD, membership management, role management, and user-facing endpoints.
- Builder hooks (
ConfigureOrganizationModel,AfterOrganizationSeed,AddOrganizationClaimFormatter,AddOrganizationScopeResolver) mirroring Identity Base extensibility points.
Installation
1. Add the package
dotnet add package Identity.Base.Organizations
2. Register services
Add the organizations services after AddIdentityBase (and optionally AddIdentityRoles) in Program.cs:
using Identity.Base.Extensions;
using Identity.Base.Organizations.Data;
using Identity.Base.Organizations.Extensions;
using Microsoft.EntityFrameworkCore;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddIdentityBase(builder.Configuration, builder.Environment);
var rolesBuilder = builder.Services.AddIdentityRoles(builder.Configuration);
rolesBuilder.AddDbContext<IdentityRolesDbContext>((provider, options) =>
{
var connectionString = builder.Configuration.GetConnectionString("Primary")!;
options.UseNpgsql(connectionString);
});
var organizationsBuilder = builder.Services.AddIdentityBaseOrganizations(options =>
{
var connectionString = builder.Configuration.GetConnectionString("Primary")!;
options.UseNpgsql(connectionString);
});
var app = builder.Build();
app.UseApiPipeline(appBuilder => appBuilder.UseSerilogRequestLogging());
app.MapApiEndpoints();
app.MapIdentityRolesUserEndpoints();
app.MapIdentityBaseOrganizationEndpoints();
await app.RunAsync();
If you omit the options callback, the package attempts to use the IdentityOrganizations connection string from configuration.
3. Apply migrations
Identity.Base.Organizations ships with an initial migration for OrganizationDbContext:
dotnet ef database update \
--project Identity.Base.Organizations/Identity.Base.Organizations.csproj \
--context Identity.Base.Organizations.Data.OrganizationDbContext
The hosted OrganizationMigrationHostedService also applies pending migrations on startup when the provider is relational.
4. Seed default roles
OrganizationRoleSeeder creates the default system roles. Register additional callbacks if you need to extend the seed pipeline:
organizationsBuilder.AfterOrganizationSeed(async (sp, ct) =>
{
// e.g. provision billing metadata, assign baseline memberships, etc.
});
5. Customize the model
Use ConfigureOrganizationModel to add indexes or shadow properties:
organizationsBuilder.ConfigureOrganizationModel(modelBuilder =>
{
modelBuilder.Entity<Organization>().HasIndex(org => org.CreatedAtUtc);
});
API surface
| Method & Route | Description | Permission |
|---|---|---|
GET /organizations |
List organizations (optionally filter by tenantId query). |
organizations.read |
POST /organizations |
Create an organization. | organizations.manage |
GET /organizations/{id} |
Retrieve one organization. | organizations.read |
PATCH /organizations/{id} |
Update display name, metadata, or status. | organizations.manage |
DELETE /organizations/{id} |
Archive an organization. | organizations.manage |
GET /organizations/{id}/members |
List memberships + role assignments. | organization.members.read |
POST /organizations/{id}/members |
Add a user to the organization. | organization.members.manage |
PUT /organizations/{id}/members/{userId} |
Update membership roles/primary flag. | organization.members.manage |
DELETE /organizations/{id}/members/{userId} |
Remove a membership. | organization.members.manage |
GET /organizations/{id}/roles |
List organization + shared roles. | organization.roles.read |
POST /organizations/{id}/roles |
Create a custom organization role. | organization.roles.manage |
DELETE /organizations/{id}/roles/{roleId} |
Delete a custom role. | organization.roles.manage |
Authorization is enforced through the Identity Base RBAC package. The default IOrganizationScopeResolver verifies the caller is a member of the target organization; override it (or IPermissionClaimFormatter) via the builder extensions to compose tenant-specific or elevated administrator rules.
Options
OrganizationOptionsSlugMaxLength,DisplayNameMaxLengthMetadataMaxBytes,MetadataMaxKeyLength,MetadataMaxValueLength
OrganizationRoleOptionsNameMaxLength,DescriptionMaxLength- Default role names (
OwnerRoleName,ManagerRoleName,MemberRoleName)
Bind or override using the standard options pattern:
builder.Services.Configure<OrganizationOptions>(builder.Configuration.GetSection("Organizations"));
Extensibility
organizationsBuilder
.ConfigureOrganizationModel(modelBuilder => { /* custom EF configuration */ })
.AfterOrganizationSeed(async (sp, ct) => { /* custom seeding */ })
.AddOrganizationClaimFormatter<CustomFormatter>()
.AddOrganizationScopeResolver<CustomScopeResolver>();
Testing
Run the solution tests to execute the organizations unit suite alongside the existing Identity Base coverage:
dotnet test Identity.sln
License
MIT, consistent with the rest of the Identity Base OSS packages.
| 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
- FluentValidation (>= 12.0.0)
- Identity.Base (>= 0.5.1)
- Identity.Base.Roles (>= 0.5.1)
- Microsoft.AspNetCore.Routing.Abstractions (>= 2.3.0)
- Microsoft.EntityFrameworkCore (>= 9.0.10)
- Microsoft.EntityFrameworkCore.Relational (>= 9.0.10)
- Microsoft.Extensions.Configuration (>= 9.0.10)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 9.0.10)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.10)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 9.0.4)
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.7.15 | 0 | 1/6/2026 |
| 0.7.12 | 83 | 12/30/2025 |
| 0.7.9 | 285 | 12/17/2025 |
| 0.7.7 | 195 | 12/3/2025 |
| 0.7.6 | 198 | 11/26/2025 |
| 0.7.5 | 331 | 11/14/2025 |
| 0.7.4 | 296 | 11/13/2025 |
| 0.7.3 | 293 | 11/10/2025 |
| 0.7.2 | 201 | 11/9/2025 |
| 0.7.1 | 146 | 11/9/2025 |
| 0.6.3 | 148 | 11/8/2025 |
| 0.6.2 | 144 | 11/8/2025 |
| 0.6.1 | 185 | 11/6/2025 |
| 0.5.10 | 183 | 11/5/2025 |
| 0.5.1 | 202 | 11/2/2025 |
| 0.2.7 | 133 | 11/1/2025 |
| 0.2.4 | 195 | 10/29/2025 |
| 0.2.3 | 190 | 10/29/2025 |