dto

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumers

type Consumers struct {
	Name string `json:"name" yaml:"name"`

	// key-auth and basic-auth
	Credential string `json:"credential,omitempty" yaml:"credential,omitempty"`

	// hmac-auth
	Key    string `json:"key,omitempty" yaml:"key,omitempty"`
	Secret string `json:"secret,omitempty" yaml:"secret,omitempty"` // for hmac-auth only

	// for jwt-auth
	Issuer           string   `json:"issuer,omitempty" yaml:"issuer,omitempty"`                         // for jwt-auth only
	Jwks             string   `json:"jwks,omitempty" yaml:"jwks,omitempty"`                             // for jwt-auth only
	FromParams       []string `json:"from_params,omitempty" yaml:"from_params,omitempty"`               // for jwt-auth only   default: ["access_token"]
	FromCookies      []string `json:"from_cookies,omitempty" yaml:"from_cookies,omitempty"`             // for jwt-auth only   default: -
	KeepToken        bool     `json:"keep_token,omitempty" yaml:"keep_token,omitempty"`                 // for jwt-auth only   default: true
	ClockSkewSeconds int      `json:"clock_skew_seconds,omitempty" yaml:"clock_skew_seconds,omitempty"` // for jwt-auth only   default: 60

}

type MsePluginConfig

type MsePluginConfig struct {
	Consumers  []Consumers `json:"consumers,omitempty" yaml:"consumers,omitempty"`
	Keys       []string    `json:"keys,omitempty" yaml:"keys,omitempty"`
	InQuery    bool        `json:"in_query,omitempty" yaml:"in_query,omitempty"`       // [key-auth 参数] [in_query 和 in_header 至少一个为 true] 配置 true 时,网关会尝试从 URL 参数中解析 API Key, 默认 true
	InHeader   bool        `json:"in_header,omitempty" yaml:"in_header,omitempty"`     // [key-auth 参数] [in_query 和 in_header 至少一个为 true] 配置 true 时,网关会尝试从 HTTP 请求头中解析 API Key, 默认 true
	DateOffset int         `json:"date_offset,omitempty" yaml:"date_offset,omitempty"` // [para-sign-auth、hmac-auth 参数], 单位 秒, 默认 300s
	Rules      []Rules     `json:"_rules_,omitempty" yaml:"_rules_,omitempty"`
}

type Rules

type Rules struct {
	MatchRoute []string `json:"_match_route_,omitempty" yaml:"_match_route_,omitempty"` // 路由生效(与 域名生效 二选一)
	Allow      []string `json:"allow,omitempty" yaml:"allow,omitempty"`

	// 以下为自定义开发 MSE 插件使用的配置
	// erda-para-sign-auth
	Consumers            []Consumers `json:"consumers,omitempty" yaml:"consumers,omitempty"`
	RequestBodySizeLimit int         `json:"request_body_size_limit,omitempty" yaml:"request_body_size_limit,omitempty"` // [erda-para-sign-auth 参数], 单位 Byte, 默认 10MB
	DateOffset           int         `json:"date_offset,omitempty" yaml:"date_offset,omitempty"`                         // [erda-para-sign-auth], 单位 秒, 默认 300s

	// erda-ip
	IPSource  string `json:"ip_source,omitempty" yaml:"ip_source,omitempty"`
	IpAclType string `json:"ip_acl_type,omitempty" yaml:"ip_acl_type,omitempty"`
	// 白名单对应一定要设置,黑名单可以不设置
	IpAclList []string `json:"ip_acl_list,omitempty" yaml:"ip_acl_list,omitempty"`

	// erda-sbac
	AccessControlAPI string   `json:"access_control_api,omitempty" yaml:"access_control_api,omitempty"`
	HttpMethods      []string `json:"http_methods,omitempty" yaml:"http_methods,omitempty"`
	MatchPatterns    []string `json:"match_patterns,omitempty" yaml:"match_patterns,omitempty"`
	WithHeaders      []string `json:"with_headers,omitempty" yaml:"with_headers,omitempty"`
	WithCookie       bool     `json:"with_cookie,omitempty" yaml:"with_cookie,omitempty"`

	// erda-csrf
	UserCookie     string   `json:"userCookie,omitempty" yaml:"userCookie,omitempty"`         // 鉴别 Cookie
	ExcludedMethod []string `json:"excludedMethod,omitempty" yaml:"excludedMethod,omitempty"` //关闭校验的 HTTP Methods 列表
	TokenName      string   `json:"tokenName,omitempty" yaml:"tokenName,omitempty"`           // token 名称
	TokenDomain    string   `json:"tokenDomain,omitempty" yaml:"tokenDomain,omitempty"`       // token 域名
	CookieSecure   bool     `json:"cookieSecure,omitempty" yaml:"cookieSecure,omitempty"`     // secure 开关
	ValidTTL       int64    `json:"validTTL,omitempty" yaml:"validTTL,omitempty"`             // token 过期时间(单位s)
	RefreshTTL     int64    `json:"refreshTTL,omitempty" yaml:"refreshTTL,omitempty"`         // token 更新周期(单位s)
	ErrStatus      int64    `json:"errStatus,omitempty" yaml:"errStatus,omitempty"`           // 失败状态码
	ErrMsg         string   `json:"errMsg,omitempty" yaml:"errMsg,omitempty"`                 // 失败应答
	JWTSecret      string   `json:"jwtSecret,omitempty" yaml:"jwtSecret,omitempty"`           // 用于加密的 Secret

}

type SortConsumers

type SortConsumers struct {
	Consumers []Consumers
	By        func(p, q *Consumers) bool
}

func (SortConsumers) Len

func (cs SortConsumers) Len() int

func (SortConsumers) Less

func (cs SortConsumers) Less(i, j int) bool

func (SortConsumers) Swap

func (cs SortConsumers) Swap(i, j int)

type SortRules

type SortRules struct {
	Rules []Rules
	By    func(p, q *Rules) bool
}

func (SortRules) Len

func (cs SortRules) Len() int

func (SortRules) Less

func (cs SortRules) Less(i, j int) bool

func (SortRules) Swap

func (cs SortRules) Swap(i, j int)

Jump to

Keyboard shortcuts

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