Documentation ¶
Index ¶
- func CORSMiddleware(skippers ...SkipperFunc) gin.HandlerFunc
- func CORSMiddleware2(skippers ...SkipperFunc) gin.HandlerFunc
- func CopyBodyMiddleware(skippers ...SkipperFunc) gin.HandlerFunc
- func EmptyMiddleware() gin.HandlerFunc
- func GizMiddleware(skippers ...SkipperFunc) gin.HandlerFunc
- func I18nMiddleware(bundle *i18n.Bundle) gin.HandlerFunc
- func JoinPath(paths ...string) string
- func JoinRouter(method, path string) string
- func LoggerMiddleware(skippers ...SkipperFunc) gin.HandlerFunc
- func NoMethodHandler() gin.HandlerFunc
- func NoRouteHandler() gin.HandlerFunc
- func RateLimiterMiddleware(skippers ...SkipperFunc) gin.HandlerFunc
- func RecoveryMiddleware() gin.HandlerFunc
- func SkipHandler(c *gin.Context, skippers ...SkipperFunc) bool
- func TraceMiddleware(skippers ...SkipperFunc) gin.HandlerFunc
- func UseAuthClientMiddleware(skippers ...SkipperFunc) gin.HandlerFunc
- func UseAuthServerMiddleware(c *gin.Context, ...)
- func UseRemoteAuthz(c *gin.Context, user *SigninUser, authz string) bool
- func UserAuthMiddleware(a auth.Auther, skippers ...SkipperFunc) gin.HandlerFunc
- func WWWMiddleware(root string, skippers ...SkipperFunc) gin.HandlerFunc
- type SigninUser
- func (u *SigninUser) GetAccount() string
- func (u *SigninUser) GetAccount1() string
- func (u *SigninUser) GetAccount2() string
- func (u *SigninUser) GetAccountIdx() int64
- func (u *SigninUser) GetAgent() string
- func (u *SigninUser) GetAudience() string
- func (u *SigninUser) GetDomain() string
- func (u *SigninUser) GetIssuer() string
- func (u *SigninUser) GetOrgAdmin() string
- func (u *SigninUser) GetOrgCode() string
- func (u *SigninUser) GetOrgUsrID() string
- func (u *SigninUser) GetScope() string
- func (u *SigninUser) GetTokenID() string
- func (u *SigninUser) GetTokenPID() string
- func (u *SigninUser) GetUserID() string
- func (u *SigninUser) GetUserIdx() int64
- func (u *SigninUser) GetUserName() string
- func (u *SigninUser) GetUserRoles() []string
- func (u *SigninUser) GetUserSvcRoles(svc string) []string
- func (u *SigninUser) SetUserRoles(roles []string)
- type SkipperFunc
- type UserIdx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CORSMiddleware ¶
func CORSMiddleware(skippers ...SkipperFunc) gin.HandlerFunc
CORSMiddleware 跨域
func CORSMiddleware2 ¶
func CORSMiddleware2(skippers ...SkipperFunc) gin.HandlerFunc
CORSMiddleware2 跨域 不推荐使用,可以使用gin中的跨域处理
func CopyBodyMiddleware ¶
func CopyBodyMiddleware(skippers ...SkipperFunc) gin.HandlerFunc
CopyBodyMiddleware 复制 request body 内容
func GizMiddleware ¶
func GizMiddleware(skippers ...SkipperFunc) gin.HandlerFunc
GizMiddleware Giz, 主要部署前端时候(www中间件)对静态资源进行压缩
func LoggerMiddleware ¶
func LoggerMiddleware(skippers ...SkipperFunc) gin.HandlerFunc
LoggerMiddleware 日志中间件
func RateLimiterMiddleware ¶
func RateLimiterMiddleware(skippers ...SkipperFunc) gin.HandlerFunc
RateLimiterMiddleware 请求频率限制中间件
func SkipHandler ¶
func SkipHandler(c *gin.Context, skippers ...SkipperFunc) bool
SkipHandler 统一处理跳过函数
func TraceMiddleware ¶
func TraceMiddleware(skippers ...SkipperFunc) gin.HandlerFunc
TraceMiddleware 跟踪ID中间件
func UseAuthClientMiddleware ¶ added in v1.0.3
func UseAuthClientMiddleware(skippers ...SkipperFunc) gin.HandlerFunc
UseAuthClientMiddleware 用户授权中间件, 只判定登录权限
func UseAuthServerMiddleware ¶ added in v1.0.3
func UseAuthServerMiddleware(c *gin.Context, gf func(*gin.Context, auth.UserInfo) (aid, uid int64, err error))
UseAuthServerMiddleware 用户授权中间件
func UseRemoteAuthz ¶ added in v1.0.3
func UseRemoteAuthz(c *gin.Context, user *SigninUser, authz string) bool
UseRemoteAuthz ... proxy_set_header X-Request-Id $req_id; proxy_set_header X-Request-Origin-Host $host; proxy_set_header X-Request-Origin-Path $request_uri; proxy_set_header X-Request-Origin-Method $request_method;
func UserAuthMiddleware ¶
func UserAuthMiddleware(a auth.Auther, skippers ...SkipperFunc) gin.HandlerFunc
UserAuthMiddleware 用户授权中间件,废弃,请使用UserAuthCasbinMiddleware
func WWWMiddleware ¶
func WWWMiddleware(root string, skippers ...SkipperFunc) gin.HandlerFunc
WWWMiddleware 静态站点中间件
Types ¶
type SigninUser ¶ added in v1.0.3
type SigninUser struct { TokenID string `header:"X-Request-Z-Token-Kid"` TokenPID string `header:"X-Request-Z-Token-Pid"` AccoIdx int64 `header:"X-Request-Z-Account-Id"` UserIdx int64 `header:"X-Request-Z-User-Id"` Account string `header:"X-Request-Z-Account"` Account1 string `header:"X-Request-Z-Account1"` Account2 string `header:"X-Request-Z-Account2"` UserID string `header:"X-Request-Z-User-Kid"` UserName string `header:"X-Request-Z-User-Name"` UserRoles string `header:"X-Request-Z-User-Roles"` OrgCode string `header:"X-Request-Z-Org-Code"` OrgAdmin string `header:"X-Request-Z-Org-Admin"` OrgUsrID string `header:"X-Request-Z-Org-Usrid"` Agent string `header:"X-Request-Z-Agent"` Scope string `header:"X-Request-Z-Scope"` Domain string `header:"X-Request-Z-Domain"` Issuer string `header:"X-Request-Z-Issuer"` Audience string `header:"X-Request-Z-Audience"` ZgoXip string `header:"X-Request-Z-Xip"` }
SigninUser 登陆用户信息
func (*SigninUser) GetAccount ¶ added in v1.0.3
func (u *SigninUser) GetAccount() string
GetAccount xxx
func (*SigninUser) GetAccount1 ¶ added in v1.0.3
func (u *SigninUser) GetAccount1() string
GetAccount1 xxx
func (*SigninUser) GetAccount2 ¶ added in v1.0.3
func (u *SigninUser) GetAccount2() string
GetAccount2 xxx
func (*SigninUser) GetAccountIdx ¶ added in v1.0.3
func (u *SigninUser) GetAccountIdx() int64
GetAccountIdx ...
func (*SigninUser) GetAudience ¶ added in v1.0.3
func (u *SigninUser) GetAudience() string
GetAudience xxx
func (*SigninUser) GetDomain ¶ added in v1.0.3
func (u *SigninUser) GetDomain() string
GetDomain xxx
func (*SigninUser) GetIssuer ¶ added in v1.0.3
func (u *SigninUser) GetIssuer() string
GetIssuer xxx
func (*SigninUser) GetOrgAdmin ¶ added in v1.0.3
func (u *SigninUser) GetOrgAdmin() string
GetOrgAdmin xxx
func (*SigninUser) GetOrgCode ¶ added in v1.0.3
func (u *SigninUser) GetOrgCode() string
GetOrgCode xxx
func (*SigninUser) GetOrgUsrID ¶ added in v1.0.3
func (u *SigninUser) GetOrgUsrID() string
GetOrgUsrID xxx
func (*SigninUser) GetTokenID ¶ added in v1.0.3
func (u *SigninUser) GetTokenID() string
GetTokenID xxx
func (*SigninUser) GetTokenPID ¶ added in v1.0.3
func (u *SigninUser) GetTokenPID() string
GetTokenPID xxx
func (*SigninUser) GetUserID ¶ added in v1.0.3
func (u *SigninUser) GetUserID() string
GetUserID xxx
func (*SigninUser) GetUserIdx ¶ added in v1.0.3
func (u *SigninUser) GetUserIdx() int64
GetUserIdx ...
func (*SigninUser) GetUserName ¶ added in v1.0.3
func (u *SigninUser) GetUserName() string
GetUserName xxx
func (*SigninUser) GetUserRoles ¶ added in v1.0.3
func (u *SigninUser) GetUserRoles() []string
GetUserRoles xxx
func (*SigninUser) GetUserSvcRoles ¶ added in v1.0.3
func (u *SigninUser) GetUserSvcRoles(svc string) []string
GetUserSvcRoles xxx
func (*SigninUser) SetUserRoles ¶ added in v1.0.3
func (u *SigninUser) SetUserRoles(roles []string)
SetUserRoles xxx
type SkipperFunc ¶
SkipperFunc 定义中间件跳过函数
func AllowMethodAndPathPrefixSkipper ¶
func AllowMethodAndPathPrefixSkipper(prefixes ...string) SkipperFunc
AllowMethodAndPathPrefixSkipper 检查请求方法和路径是否包含指定的前缀,如果不包含则跳过
func AllowPathPrefixNoSkipper ¶
func AllowPathPrefixNoSkipper(prefixes ...string) SkipperFunc
AllowPathPrefixNoSkipper 检查请求路径是否包含指定的前缀,如果包含则不跳过
func AllowPathPrefixSkipper ¶
func AllowPathPrefixSkipper(prefixes ...string) SkipperFunc
AllowPathPrefixSkipper 检查请求路径是否包含指定的前缀,如果包含则跳过