Skip to content

Files

Latest commit

ed1f87b · Nov 23, 2024

History

History

Example1.RazorPages.IndividualAccounts

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
May 25, 2021
Jun 2, 2021
Dec 22, 2022
Dec 27, 2022
Dec 26, 2022
May 25, 2021
Jan 4, 2023
Dec 27, 2022
Dec 26, 2022
Dec 26, 2022
Dec 24, 2022
Nov 23, 2024
Feb 28, 2024
Jul 3, 2021
May 25, 2021
Dec 15, 2022
Aug 21, 2021

Example1.RazorPages.IndividualAccounts

This project contains a example of using the AuthPermissions.AspNetCore library in ASP.NET Core razor page web app with user data provided by the individual accounts approach. This is one of the simplest approaches using:

This article (!!! LINK !!!) details how this example was built, and how it works.

  • Application: ASP.NET Core, Razor Pages
  • AuthorizationProvider: ASP.NET Core's individual accounts
  • CookieOrToken: Cookie
  • MultiTenant: not used
  • Databases: Two databases
    • Individual accounts: InMemoryDatabase:
    • AuthPermissions: In-memory database (uses SQLite in-memory).
  • Focused on: The basics of the AuthPermissions authorization system.

The ASP.NET Core code comes comes from the ASP.NET Core documentation on building razor page web app individual accounts authorization, but the handling of the visibilty of the contact manager features are handled by the AuthPermissions.AspNetCore library.

The AuthPermissions.AspNetCore code/features used in this example

  • Adding the AuthPermissions into your ASP.NET Core application.
  • Bulk loading AuthPermissions Roles and Users.
  • Mapping the user's Roles to Permissions.
  • Authorization in razor pages via the [HasPermission(<enum permission>)] attribute on the PageModel class.
  • Authorization in razor pages via the User.HasPermission(<enum permission>) method.
  • Add SuperUser on startup feature.

NOTE: This example does not include the admin pages for

NOTE: This article provides a good overview of the standard ASP.NET Core authorization approaches.