system_manage_traefik_plugin

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

README

OpenApi Traefik中间件

请求地址: /open_api/{目标系统标识}/{目标系统路由}?{请求参数}
请求头:

  • X-OpenApi-SN 本系统标识
  • X-OpenApi-Authtype 授权类型(ticket\sign)
    前端调用:
  • X-OpenApi-Ticket ticket生成指南
  • X-OpenApi-ExpireTime ticket过期时间(时间戳,秒级)
  • X-OpenApi-AllowSn ticket授权信息
    后端调用:
  • X-OpenApi-Sign sign生成指南
  • X-OpenApi-Nonce 随机数,建议8位
  • X-OpenApi-Timestamp 时间戳,秒级
  • X-OpenApi-SignPara 需要签名的参数(--暂未实现)

功能

  • 记录OpenApi请求日志
  • OpenApi鉴权
ticket生成指南

ticket = md5 32位小写([X-OpenApi-AllowSn]+[X-OpenApi-ExpireTime]+[SystemSecret])

sign生成指南

sign = md5 32位小写([X-OpenApi-Nonce]+[X-OpenApi-Timestamp]+[SystemSecret])

Documentation

Overview

Package plugindemo a demo plugin.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error)

New created a new Demo plugin.

Types

type Config

type Config struct {
	Headers  map[string]string `json:"headers,omitempty"`
	EtcdAddr string            `json:"etcd_addr,omitempty"`
	LokiAddr string            `json:"loki_addr,omitempty"`
}

Config the plugin configuration.

func CreateConfig

func CreateConfig() *Config

CreateConfig creates the default plugin configuration.

type Demo

type Demo struct {
	// contains filtered or unexported fields
}

Demo a Demo plugin.

func (*Demo) ServeHTTP

func (a *Demo) ServeHTTP(rw http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL