GithubHelp home page GithubHelp logo

zijianhuang / authef Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 2.0 823 KB

Libraries for utilizing ASP.NET Identity and Entity Framework Core, neutral to database engines

Batchfile 0.05% JavaScript 0.32% TypeScript 15.44% CSS 0.66% HTML 0.28% C# 82.03% PowerShell 1.21%

authef's Introduction

This repository serves multiple purposes:

  1. Demonstrate "Decouple ASP.NET Core Identity, Authentication and Database Engines"
  2. Demonstrate "Share Identity Bear Tokens among ASP.NET Core Web APIs"
  3. Demonstrate "Resource Owner Password Credentials Grant and Refreshing Token with ASP.NET Core Identity"
  4. Provide some plugin components that decouple business modules from concrete SQL database engines.
  5. Provide some components that decouple ASP.NET Core Identity with concrete database engines.
  6. Demonstrate how to craft integration tests and run on local dev PC as much as possible, and the artifacts could be easily reused in a team CI server like GitHub Actions/Workflow.

Decoupling Entity Framework and DB Engines

Provides a few libraries to decouple business modules from concrete SQL database engines:

  1. Fonlow.EntityFrameworkCore.Abstract
  2. Fonlow.EntityFrameworkCore.MySql
  3. Fonlow.EntityFrameworkCore.Sqlite
  4. Fonlow.EntityFrameworkCore.MsSql
  5. Fonlow.EntityFrameworkCore.PostgreSQL

Therefore, through altering a connection string in the app settings, your app can switch to another DB engine during deployment, along with the plugin assembly and its dependencies.

Hints:

  • It should be quick and easy for you to write Fonlow.EntityFrameworkCore.MyFavoriteDbEngine for MS SQL or Oracle etc.

ASP.NET Core Identity

Provides a few libraries to create a database of ASP.NET Core Identity with a concrete database engine:

  1. Fonlow.AspNetCore.Identity
  2. Fonlow.AuthDbCreator
  3. Fonlow.WebApp.Accounts

Please read the readme.md file of each library.

Hints:

  • Even if you don't use ASP.NET Core Identity for authentication, but something like Okta, Auth0 or Azure AD / MS Entra ID, doupling main business modules from the authentication implementation is beneficial to CI and business, and having a locally hosted ASP.NET Core Identity implementation makes integration tests fast as explained below.
  • Microsoft has provided similar classes out of the box from libraries or scaffolding codes of ASP.NET MVC, however, using string for ID, while these libraries use GUID.

===Article later ===========

Microsoft .NET Framework and .NET Core have provided architectural design for application programmer to decouple the concrete implementation of authentication from the main business logic codes, through a class named AuthorizeAttribute in variety of its development frameworks:

  1. System.WebHttp.AuthorizeAttribute of .NET Framework
  2. System.Web.Mvc.AuthorizeAttribute of .NET Framework
  3. ...
  4. Microsoft.AspNetCore.Authorization.AuthorizeAttribute

In addition to the architectural design, such naming convention through name "AthorizeAttribute" makes code migrations and switching authentication mechanism even easier.

Remarks:

The decoupling in WCF goes through different approach, as described on https://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/authentication-in-wcf

authef's People

Contributors

zijianhuang avatar zijianflg avatar

Stargazers

 avatar  avatar  avatar Moisei Mihai avatar  avatar

Watchers

 avatar  avatar

Forkers

atikhan gchacko

authef's Issues

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.