ApiFeatures.Authentications.Users.Cores 10.0.0

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

ApiFeatures.Authentications.Users.Cores

The shared user model of the iot-vn Authentication Service. It has no database driver and no ASP.NET Core dependency; its only package is DataMagic.Abstractions (entity interfaces).

Targets: net9.0, net10.0.

Package: ApiFeatures.Authentications.Users.Cores on nuget.org, MIT license, with symbols (.snupkg) and Source Link. The major version follows the highest .NET version the package targets (10.x for net10.0); minor versions can contain breaking changes, so pin an exact version.

Contents

Namespace Types
ApiFeatures.Authentications.Users.Cores.Constants AuthenticationProviders, UserStatuses, ValidationConstraints, BusinessMessageCodes, ValidationMessageCodes, LoggerCategoryNames
ApiFeatures.Authentications.Users.Cores.Models IUser, UserDto, UserRoleDto, Coordinate, CentralCoordinate
ApiFeatures.Authentications.Users.Cores.Constants (roles) SystemRoles (ids, codes and display names of the system roles ADMIN and USER)
ApiFeatures.Authentications.Users.Cores.Models.Entities UserEntity, PasswordResetRequestEntity, PermissionEntity, RoleEntity, RolePermissionEntity
ApiFeatures.Authentications.Users.Cores.Models.Roles OrphanSweepResult
ApiFeatures.Authentications.Users.Cores.Models.Users UpdateUserCommand
ApiFeatures.Authentications.Users.Cores.Interfaces IUserDatabaseService, IPasswordResetRequestDatabaseService, IUsersDatabaseInitializationService, IPermissionDatabaseService, IRoleDatabaseService (the storage contracts a database library implements)

Relation to AuthenticationService.Commons

AuthenticationService.Commons (10.2.0 and later) keeps only the request/response/event messages and the MassTransit request client (IUserService / UserService), under unchanged namespaces. It depends on this package for UserDto.

The user contract (10.0.0)

UserDto carries the single role and its permissions:

Member Meaning
Role { id, code, displayName } of the role of the user
Permissions the role's permissions as joined path strings, exactly as granted ("*", "user.*", "user.create"); wildcards are not expanded
Roles (deprecated) [role code], for example ["ADMIN"] (was free text such as admin)
AssignedFeatures (deprecated) the same joined paths as Permissions

Roles and AssignedFeatures stay filled for one release and are removed in a later version.

Matching permissions in a consuming service

A required permission is one exact joined path such as user.create. Decide with the segment-safe rule, never with a regular expression:

  1. * grants everything.
  2. A grant that ends with .* (for example user.*) grants every required path that starts with the grant without its * (user.) and has at least one more character. user.* grants user.create, does not grant system_user.create and does not grant a bare user.
  3. Any other grant grants only itself.
static bool Allows(IEnumerable<string> grants, string required) =>
    grants.Any(g => g == "*" || g == required ||
        (g.EndsWith(".*", StringComparison.Ordinal) && required.Length > g.Length - 1 &&
         required.StartsWith(g[..^1], StringComparison.Ordinal)));

Version history

10.0.0 (first public release)

First version published on nuget.org. It contains everything listed under "Contents" and "The user contract" above: the content of the unpublished internal versions 1.0.0 to 2.0.0 below. The version follows the .NET-major convention (major = highest target .NET, here net10.0). AuthenticationService.Commons 10.2.0 and the ApiFeatures.Authentications.Users* 10.0.0 packages depend on it (>= 10.0.0).

Unpublished internal history

The versions below were built only inside this repository and never published to any feed.

2.0.0 (CR17, breaking)

One role per user and exact permissions. Removed: ValidRoles, UserPermissions, UpdateUserCommand.Roles / AssignedFeatures, IUserDatabaseService.SetRolesAsync. Added: UserRoleDto, UserDto.Role, UserDto.Permissions, IUserDatabaseService.SetRoleAsync / CountActiveByRoleIdAsync / GetByRoleIdAsync / DeleteByIdAsync and the roleId filter of SearchAsync, IRoleDatabaseService.GetByIdsAsync. Deprecated for one release: UserDto.Roles (now the role code), UserDto.AssignedFeatures (now the joined paths of the role), and the same members of IUser. A database library must implement the new members.

1.1.0

Additive. Roles and permissions (Task 43): PermissionEntity, RoleEntity, RolePermissionEntity, SystemRoles, OrphanSweepResult, IPermissionDatabaseService, IRoleDatabaseService, UserEntity.RoleId (nullable, the single role of the user) and two methods on IUserDatabaseService (GetWithoutRoleAsync, SetRoleWhereMissingAsync) for the startup migration. UserEntity.Roles and UserEntity.AssignedFeatures are marked deprecated: they stay stored for a rollback. A database library written against an earlier 1.1.0 build must implement the new members.

Role and permission management (Task 44, still 1.1.0: unpublished): IRoleDatabaseService gains SearchAsync, GetByCodeAsync, GetPermissionGrantsByRoleIdsAsync, InsertAsync, UpdateAsync, DeleteAsync and CountRolesHoldingAsync; IPermissionDatabaseService gains GetByIdAsync, GetByJoinedPathAsync, GetByCodesAsync, InsertAsync, UpdateAsync and DeleteAsync; IUserDatabaseService gains CountByRoleIdsAsync. New types: RoleGrant, RoleDeletionResults, PermissionDeletionResults, PermissionInsertResults. A database library must implement the new members.

Storage interfaces: Adds the storage interfaces (IUserDatabaseService, IPasswordResetRequestDatabaseService, IUsersDatabaseInitializationService), LoggerCategoryNames and UpdateUserCommand. No existing type changed. Passwords are verified by the business, never matched in a query: IUserDatabaseService has no lookup by hashed password and has ReplaceHashedPasswordAsync(id, currentHashedPassword, hashedPassword), a compare-and-set (sets the value only when the stored one is exactly currentHashedPassword, returns whether a user changed, leaves UpdatedTime alone). 1.1.0 was never published, so the version stays. A session service key (UsersServiceKeys) that this version once listed was removed before publication (Task 33): the session key belongs to the host. The three exception-filter logger category names that this version once listed were removed before publication (Task 34): the host's error handling owns its log categories.

1.0.0

First release. Holds the types that AuthenticationService.Commons 10.x (constants, IUser, UserDto, Coordinate, CentralCoordinate) and AuthenticationService.Cores 10.x (UserEntity, PasswordResetRequestEntity) contained, now under ApiFeatures.Authentications.Users.Cores namespaces. RefreshTokenEntity is not carried over.

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 is compatible.  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 (4)

Showing the top 4 NuGet packages that depend on ApiFeatures.Authentications.Users.Cores:

Package Downloads
AuthenticationService.Commons

MassTransit contracts of the iot-vn Authentication Service: the user request, response and event messages and the IUserService request client that other services use to read users. The user model (UserDto) comes from ApiFeatures.Authentications.Users.Cores.

ApiFeatures.Authentications.Users.Databases.Mongo

MongoDB storage of the iot-vn Authentication Service Users module: registers the user and password reset request storage on MongoDB from DataMagic MongoDatabaseOptions or a connection string.

ApiFeatures.Authentications.Users.Databases.Postgres

PostgreSQL storage of the iot-vn Authentication Service Users module: registers the user and password reset request storage on PostgreSQL from DataMagic PostgresqlDatabaseOptions, and ships the EF Core migrations.

ApiFeatures.Authentications.Users

The Users module of the iot-vn Authentication Service: the user endpoints, authorization, consumers and hosted services. It reads no configuration and registers no database.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.0 68 11/24/2026

10.0.0: first public release. The shared user model of the iot-vn Authentication Service: the user constants, IUser, UserDto (one Role with exact Permissions as joined paths such as "*" or "user.*"; Roles and AssignedFeatures deprecated), UserRoleDto, Coordinate, CentralCoordinate, the user, password reset request, role and permission entities, and the storage interfaces a Users database library implements (IUserDatabaseService, IPasswordResetRequestDatabaseService, IUsersDatabaseInitializationService, IRoleDatabaseService, IPermissionDatabaseService). The internal versions 1.0.0 to 2.0.0 were never published (see the README version history). Versioning: the major version is the highest .NET version targeted; minor versions can be breaking, so pin an exact version.