Skip to content
Jon P Smith edited this page Jan 10, 2024 · 28 revisions

Welcome to the AuthPermissions.AspNetCore (referred to as AuthP) library documentation.

NOTE: The documentation has been updated to Version 6.2.0 of the AuthP library.

If you are new to the AuthP then make sure to have had a look at the Readme file which gives an overview of what the library, and the Roadmap discussions for future plans and limitations.

The AuthP library is fairly complex and to help you the the documentation is broken up in to the following topics as shown in the sidebar.

  • Articles / Videos: which introduce different features in the AuthP library.
  • Concepts: which explains the various parts of the AuthP library.
  • Setup: which shows how to set up the AuthP in your application.
  • Usage: which explains how to use the AuthP features to enhance your application.
  • Admin: which covers the services used to manage Roles, AuthUsers, and Tenants.
  • SupportCode: which contains useful services that aren't part of the AuthP setup.

Example code in this repo

The AuthPermissions.AspNetCore repo contains the following example of using AuthP with ASP.NET Core applications listed below. All of them can be run and show a HOME page describes what the application does (apart from the WebAPI example, which shows the Swagger display).

Example1 - Roles and permissions

This is a ASP.NET Core Razor Pages application using the Individual Accounts authentication provider with Cookie authentication. Look at this example for:

  • A very simple example of using AuthP's authorization Roles and AuthUsers
  • A comparison between ASP.NET Core authorization with AuthP's authorization
  • A standard admin of AuthP's Roles and Users.

Example2 - JWT Token in ASP.NET Core Web API

This is a ASP.NET Core WebAPI application using the Individual Accounts authentication provider with JWT Token authentication. Look at this example for:

  • An example of using AuthP to create a JWT Token for you.
  • An example of using AuthP's JWT refresh feature.

See the video Improving JWT Token Security for more about this feature works.

NOTE: When running this example and you want to login you must run one of the authentication login WebAPIs and then copy the just the JWT Token string in into Swagger's Authorize box. Also, the default lifetime of the JWT Token is 5 minutes, so you wll get logged out quickly (this is done to check the AuthP's JWT refresh feature).

Example3 - Single level multi-tenant application

This is a ASP.NET Core MVC application using the Individual Accounts authentication provider with Cookie authentication. Look at this example for:

  • How to use AuthP to create a single-level multi-tenant system.
  • How to use tenant Roles to offer different versions of your application, e.g. Free, Pro, Enterprise, to offer to your users.
  • Ways to move the administrator of the users in an tenant to a local tenant admin user.
  • Providing customer support users to link to a tenant's data to diagnose tenant user's problems.
  • Demo of changing the look and feel of an app when a tenant logs in.

Example4 - Hierarchical multi-tenant application

This is a ASP.NET Core MVC application using the Individual Accounts authentication provider with Cookie authentication. Look at this example for:

  • How to use AuthP to create a hierarchical multi-tenant system.
  • Diverts users from a tenant while its data is moved / changed + plus updating the user's claims after a move.
  • A more substantial application with lots of Permissions, Roles, Tenants and Users.
  • How the AuthP' admin code can be used to control Roles, Users and Tenants.

Example5 - Login via Azure AD

This is a ASP.NET Core MVC application using the Azure AD authentication provider with Cookie authentication. Look at this example for:

  • How to use Azure AD authentication with the AuthP library.

Example6 - Single level multi-tenant application using hybrid mode

This is a ASP.NET Core MVC application demonstrating how to spread your tenants over many database - see Sharding explained on what the hybrid mode means. Look at this example for:

  • Get a list of the databases that you can add / move tenants to - Example6 has 3 and assumes you have localdb on your development computer.
  • Create / move a tenant so that it has its own database. This will make querying that tenant's data.
  • Diverts users from a tenant while its data is moved / changed + plus updating the user's claims after a move.

Example7 - Single level multi-tenant application using sharding-only mode

This is a ASP.NET Core MVC application demonstrating how to spread your tenants over many database - see Sharding explained on what the sharding-only mode means. Look at this example for:

  • It starts up with no tenants. You can
    • Manually add a new tenant.
    • Use the "Sign up now" feature to create a new tenant.

Articles / Videos

Concepts

Setup

Usage

Admin

SupportCode

Clone this wiki locally