CPIT.UsersManager 4.3.0

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

Users Manager

User manager is a .Net library which provides a backend framework for users management. The library uses EntityFrameworkCore and Google authentication. It supports both PostgreSQL and MySQL databases.

Before You Begin

Make sure to create a GCP project and have an active OAuth Client ID, the ID should authorize the Javascript origins which will initiate the authentication process.

How To Use

Step 1: Configure Database Provider

The library supports both PostgreSQL and MySQL. You need to configure your database provider and connection string in appsettings.json:

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=localhost;Database=YourDatabase;User Id=your_user;Password=your_password;"
  },
  "DatabaseProvider": "PostgreSQL"
}

Database Provider Options:

  • "PostgreSQL" - For PostgreSQL databases (default if not specified)
  • "MySQL" - For MySQL/MariaDB databases

Connection String Examples:

For PostgreSQL:

Server=localhost;Port=5432;Database=YourDatabase;User Id=your_user;Password=your_password;

For MySQL:

Server=localhost;Port=3306;Database=YourDatabase;User=your_user;Password=your_password;
Step 2: Adding the required appsettings

You should have a "JwtSettings" section in appsettings.json file, which contains three main configurations:

  • securityKey
  • validIssuer
  • validAudience
  • expiryInMinutes Those settings can be also stored in application environment or Google secret manager, the library will be able to read them. You need also to add "GoogleAuthSettings" section in appsettings.json file, which contains three main configurations:
  • clientId
Step 3: Create Database Migrations

Important: The library does not include pre-built migrations. You must create your own migrations based on your chosen database provider.

After configuring your database provider and connection string, create an initial migration in your project:

For PostgreSQL:

dotnet ef migrations add InitialCreate --project YourProject

For MySQL:

dotnet ef migrations add InitialCreate --project YourProject

Then apply the migration to create the database schema:

dotnet ef database update --project YourProject
Step 4: Configure dependency injection

Add the following code in your Startup file

    services.AddUserAuthentication(Configuration);
Step 5: Inject the UserServices and use the supported functions

UserServices provides three main functions:

  • Login
  • Register
  • Assign roles
Step 6: Security framework

Inherit SystemPermissions and SystemRole classes in your project, and use them as an authentication policies. Example:

public class BaseRole: SystemRole {
    public const string SystemAdmin = "SystemAdmin";
}

public class BasePermissions: SystemPermissions
{
    public static readonly SystemAction CanManageUsers = new(nameof(CanManageUsers), BaseRole.SystemAdmin);
}


[Authorize(Policy = nameof(BasePermissions.CanManageUsers))]
public class UsersController : ControllerBase {

}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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
4.3.0 107 1/26/2026
4.2.1 384 11/6/2025
4.2.0 246 8/23/2025
4.1.3 863 3/4/2025
4.1.2 306 3/4/2025
4.1.1 632 8/22/2024
4.1.0 2,579 11/30/2023
4.0.0 1,809 4/26/2023
3.1.0 174 11/30/2023
3.0.0 788 1/12/2023
2.0.0 1,091 11/4/2022
1.0.0 534 11/3/2022