auth

package
v0.0.0-...-f4276bb Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAuthFilter

func NewAuthFilter(service string) restful.FilterFunction

中间件构造函数

Types

type Auth

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

func NewAuth

func NewAuth(c *rpc.Client, service string) *Auth

func (*Auth) Filter

func (a *Auth) Filter(
	req *restful.Request,
	w *restful.Response,
	next *restful.FilterChain)

业务功能

  1. 需要rpc客户端, 采用全局变量来进行设计
  2. rpc.ValidateToken 来进行鉴权 2.1 token: cookie(web)/header(Authtication)/query(websocket)参数 2.2 校验 成功 pass, 失败: 中断流程 返回认证错误(401)

Jump to

Keyboard shortcuts

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