GithubHelp home page GithubHelp logo

jangocheng / goku-plugin-apikey-auth Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eolinker/goku-plugin-apikey-auth

0.0 0.0 0.0 26 KB

GOKU API GATEWAY 官方插件:APIKEY鉴权

License: Apache License 2.0

Go 85.62% Shell 14.38%

goku-plugin-apikey-auth's Introduction

Goku Plugin:API Key

插件名称 文件名.so 插件类型 错误处理方式 作用范围 优先级
APIKey鉴权 goku-apikey_auth 访问策略 继续后续操作 转发前 1003

鉴权方式的一种,多用于OpenAPI,设置Apikey参数,Apikey默认支持在header、body、query中使用,不能通过认证的用户将无权访问接口。

目录

编译教程

环境要求

  • 系统:基于 Linux 内核(2.6.23+)的系统,CentOS、RedHat 等均可;

  • golang版本号:12.x及其以上

  • 环境变量设置:

编译步骤

1.clone项目

2.进入项目文件夹,执行build.sh

cd goku-apikey_auth && chmod +x build.sh && ./build.sh
注:build.sh为通用的插件编译脚本,自定义插件时可以拷贝直接使用。

3.执行第2步将会生成文件: {插件名}.so

将该文件上传到节点服务器运行目录下的plugin文件夹,然后在控制台安装插件即可使用。

安装插件

前往 Goku API Gateway 官方网站查看:插件安装教程

使用教程

配置页面

进入控制台 >> 策略管理 >> 某策略 >> 策略插件 >> Apikey鉴权插件:

配置参数

参数名 说明
Apikey Apikey的值
hildCredential 转发时是否隐藏Apikey
remark 备注

配置示例

[
    {
        "Apikey": "key",
        "hideCredential": false
        "remark": ""
    },
    {
        "Apikey": "key2",
        "hideCredential": false
        "remark": ""
    }
]

API请求参数

参数名 说明 必填 值可能性 参数位置
Strategy-Id 策略id header
Authorization-Type 鉴权方式 Apikey header
Authorization 鉴权值 header

请求示例

以下API测试页面来自于 eoLinker API Studio 接口管理平台
  • Apikey在 header 中:

  • Apikey在 body 中: 头部填写 Strategy-IdAuthorization-Type:

  • Apikey在 query 中: 头部填写 Strategy-IdAuthorization-Type:

goku-plugin-apikey-auth's People

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.