GithubHelp home page GithubHelp logo

9kbx / abp-api-key-authorization Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cotur/abp-api-key-authorization

0.0 0.0 0.0 501 KB

Shell 0.12% JavaScript 1.81% C# 91.91% TypeScript 2.95% CSS 0.24% HTML 2.59% Dockerfile 0.36% SCSS 0.01%

abp-api-key-authorization's Introduction

API Key Authorization Module for ABP Based Applications

This module provides adding and managing dynamic API Keys with permissions for your application.

ss1

ss2

ss3

The API Key Authorization Management UI is currently available for only MVC applications.

The API Key Authorization is currently available for only Entity Framework.

What is API Key?

An application programming interface key (API key) is a unique identifier used to authenticate a user, developer, or calling program to an API. However, they are typically used to authenticate a project with the API rather than a human user. Different platforms may implement and use API keys in different ways. (ref: wikipedia)

Pre Requirements

How to Install

This module's projects are not published yet as NuGet packages, so for now, you need to download the module via GitHub and add references each project to related application project.

  1. Download the module source code

  2. Add project references one by one as following:

    • *.Domain.Shared -> Cotur.Abp.ApiKeyAuthorization.Domain.Shared
    • *.Domain -> Cotur.Abp.ApiKeyAuthorization.Domain
  3. Add module types as DependsOn attribute parameter.

    • Example for Domain module:
    [DependsOn(
        //..
        typeof(ApiKeyAuthorizationDomainModule)
    )]
  4. Add configuration for your *.HttpApi.Host or *.Web project.

    public async override Task OnApplicationInitializationAsync(ApplicationInitializationContext context)
    {
        var app = context.GetApplicationBuilder();
        var env = context.GetEnvironment();
    
        // ..
        app.UseAuthentication();
    
        app.UseApiKeyAuthorization();
    
        app.UseAuthorization();
    
        //..
    
    }
  5. Configure your DbContext

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        base.OnModelCreating(modelBuilder);
    
        //..
        modelBuilder.ConfigureApiKeyAuthorization();
    }
  6. Add migrations & update your database

  7. [Optional] Set your api key name at your module class.

public override void ConfigureServices(ServiceConfigurationContext context)
{
    Configure<ApiKeyOptions>(o =>
    {
        o.ApiKeyName = "my-key-name";
    });
}

or

appsettings.json

{
    "apiKeys": {
        "apiKeyName": "my-key-name"
    }
}

abp-api-key-authorization's People

Contributors

cotur 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.