Coder Social home page Coder Social logo

daudihusbands / authpermissions.aspnetcore Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jonpsmith/authpermissions.aspnetcore

0.0 1.0 0.0 1.85 MB

This library provides extra authorization features to an ASP.NET Core application.

Home Page: https://www.thereformedprogrammer.net/finally-a-library-that-improves-role-authorization-in-asp-net-core/

License: MIT License

HTML 6.70% C# 92.64% CSS 0.46% JavaScript 0.20%

authpermissions.aspnetcore's Introduction

AuthPermissions.AspNetCore

The AuthPermissions.AspNetCore library (shortened to AuthP) provides extra authorization features to a ASP.NET Core application. Here are AuthP's three main features:

  • An improved Role authorization system where the features a Role can access can be changed by an admin user (i.e. no need to edit and redeploy your application when a Role changes).
  • Implements a JWT refresh token feature to improve the security of using JWT Token in your application.
  • Provides features to create a multi-tenant database system, either using one-level tenant or multi-level tenant (hierarchical).

The AuthP library also:

  • Works with any ASP.NET Core authentication provider.
  • Works with either Cookie authentication or JWT Token authentication.
  • Contains an admin services to sync the authentication provider users with AuthP's users.
  • Has a comprehensive set of admin services to manage AuthP's Roles, Tenants and Users.

The AuthP is an open-source library under the MIT licence (and remain as a open-source library for ever) and the NuGet package can be found here.

The documentation can be found in the GitHub wiki and see ReleaseNotes for details of changes. There is also a roadmap discussion containing the plans for this library.

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.RazorPages.IndividualAccounts

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 comparision between ASP.NET Core authorization with AuthP's authorization

Example2.WebApiWithToken.IndividualAccounts

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.

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 - not built yet

This example shows how AuthP would work with Azure Active Directory as the authentication provider.

Example4.MvcWebApp.IndividualAccounts

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

  • A more substantial application with lots of Permissions, Roles, Tenants and Users.
  • how to use AuthP to create a hierarchical multi-tenant system.
  • How the AuthP' admin code can be used to control Roles, Users and Tenants.

Notes on creating a NuGet package

The AuthPermissions.AspNetCore library contains more than one project. For this reason you can't (currently) create a NuGet package using NuGet values in a .csproj file.

For this reason I use the JonPSmith.MultiProjPack dotnet tool to create the NuGet package using the following command in a command line on the AuthPermissions.AspNetCore directory.

> MultiProjPack R

_NOTE: If you don't want to use the JonPSmith.MultiProjPack dotnet tool you should find a CreateNuGetRelease.nuspec file which you can call with the following command

> dotnet pack -p:NuspecFile=CreateNuGetRelease.nuspec -v q -o ./nupkg

authpermissions.aspnetcore's People

Contributors

jonpsmith avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.