Documentation ¶
Index ¶
- Constants
- Variables
- func CSRFCheck() gin.HandlerFunc
- func CSRFInit() gin.HandlerFunc
- func CacheControl() gin.HandlerFunc
- func CaptchaRequired(configName string) gin.HandlerFunc
- func CasbinCheckPermission(userID, url, methodtype string) (bool, error)
- func CasbinMiddleware(skipper ...SkipperFunc) gin.HandlerFunc
- func CheckUrlLimit(r *ratelimit.Rule, item string) (err error)
- func ContextWithSpan(c *gin.Context) (ctx context.Context, ok bool)
- func CurrentUser() gin.HandlerFunc
- func DisableLog() core.HandlerFunc
- func EcmTokenAuth(skipper ...SkipperFunc) gin.HandlerFunc
- func GetEcmUserLoginIntegrationByUserLoginNameV(c *gin.Context) (string, error)
- func GetEcmUserLoginIntegrationByUserLoginNameV1(c *gin.Context, urlHost, secretKey string) (string, error)
- func GetRealIp(c *gin.Context) string
- func GinLogger() gin.HandlerFunc
- func GinLoggerV2(fn SkipReqBodyLogByUrl) gin.HandlerFunc
- func HashID(IDType int) gin.HandlerFunc
- func Init(urls []string)
- func JWTAuth(skipper ...SkipperFunc) gin.HandlerFunc
- func ManualEmptyVisitorRecord(c *gin.Context)
- func NewTracer(servicename string, addr string) (opentracing.Tracer, io.Closer, error)
- func NoMethodHandler() gin.HandlerFunc
- func NoRouteHandler() gin.HandlerFunc
- func OBSAuth(skipper ...SkipperFunc) gin.HandlerFunc
- func PrintResponse(c *gin.Context) responseWriter
- func RateLimit(skipper ...SkipperFunc) gin.HandlerFunc
- func Recovery(logger *zap.Logger, stack bool) gin.HandlerFunc
- func RecoveryMiddleware() gin.HandlerFunc
- func RecoveryMiddlewareOld() gin.HandlerFunc
- func Session(secret string) gin.HandlerFunc
- func SetSamplingFrequency(n int)
- func SignMiddleware(headerKeys []string, urlStr string) gin.HandlerFunc
- func SignMiddlewareV2(headerKeys []string, bodyBytes []byte) gin.HandlerFunc
- type AdminUserRole
- type GetUserInfoFunc
- type LimitObj
- type SkipReqBodyLogByUrl
- type SkipperFunc
Constants ¶
View Source
const ( USER_UID_KEY = "UID" //页面UUID键名 USER_REALNAME_KEY = "RealName" USER_USERNAME_KEY = "UserName" SUPER_ADMIN_ID = "10" //超级管理员 InterfaceTrack = "interface" )
View Source
const ( PrefixUserID = "u_" PrefixRoleID = "r_" )
Variables ¶
View Source
var AllUrls []string
View Source
var IpLimit []LimitObj
View Source
var Store memstore.Store
Store session存储
View Source
var UserLimit []LimitObj
Functions ¶
func CaptchaRequired ¶
func CaptchaRequired(configName string) gin.HandlerFunc
CaptchaRequired 验证请求签名
func CasbinCheckPermission ¶
检查用户是否有权限
func CasbinMiddleware ¶
func CasbinMiddleware(skipper ...SkipperFunc) gin.HandlerFunc
CasbinMiddleware casbin中间件
func ContextWithSpan ¶
ContextWithSpan 返回context
func DisableLog ¶
func DisableLog() core.HandlerFunc
func EcmTokenAuth ¶ added in v1.2.6
func EcmTokenAuth(skipper ...SkipperFunc) gin.HandlerFunc
Ecm云文档接口检查,获取登录token
func GetEcmUserLoginIntegrationByUserLoginNameV ¶ added in v1.3.2
func GetEcmUserLoginIntegrationByUserLoginNameV1 ¶ added in v1.3.2
func GetEcmUserLoginIntegrationByUserLoginNameV1(c *gin.Context, urlHost, secretKey string) (string, error)
GetEcmToken
TODO: 获取 token,存在漏洞,当token在接口调试的过程中,通过接口获取token一定会被替换掉,则toke无法使用; 1、需要手动删除redis 中的token缓存才能生效 ⚠️:正式环境上线后,不允许手动调用token接口进行调试, 除非添加 token 校验策略: 用于判断token的有效性;
func GinLogger ¶ added in v1.4.8
func GinLogger() gin.HandlerFunc
func GinLoggerV2 ¶ added in v1.4.8
func GinLoggerV2(fn SkipReqBodyLogByUrl) gin.HandlerFunc
fn 默认传输 nil
func OBSAuth ¶
func OBSAuth(skipper ...SkipperFunc) gin.HandlerFunc
func RateLimit ¶
func RateLimit(skipper ...SkipperFunc) gin.HandlerFunc
func RecoveryMiddleware ¶
func RecoveryMiddleware() gin.HandlerFunc
func RecoveryMiddlewareOld ¶
func RecoveryMiddlewareOld() gin.HandlerFunc
func SetSamplingFrequency ¶
func SetSamplingFrequency(n int)
SetSamplingFrequency 设置采样频率 0 <= n <= 100
func SignMiddleware ¶
func SignMiddleware(headerKeys []string, urlStr string) gin.HandlerFunc
SignMiddleware 生成签名中间件函数 headerKeys 不同接口对应不同请求头,需查看 财务云 接口文件进行传输
func SignMiddlewareV2 ¶
func SignMiddlewareV2(headerKeys []string, bodyBytes []byte) gin.HandlerFunc
SignMiddleware 生成签名中间件函数 headerKeys 不同接口对应不同请求头,需查看 财务云 接口文件进行传输
Types ¶
type AdminUserRole ¶
type GetUserInfoFunc ¶ added in v1.4.8
type SkipReqBodyLogByUrl ¶ added in v1.5.34
type SkipperFunc ¶
SkipperFunc 定义中间件跳过函数
func AllowPathPrefixNoSkipper ¶
func AllowPathPrefixNoSkipper(prefixes ...string) SkipperFunc
AllowPathPrefixNoSkipper 检查请求路径是否包含指定的前缀,如果包含则不跳过
func AllowPathPrefixSkipper ¶
func AllowPathPrefixSkipper(prefixes ...string) SkipperFunc
AllowPathPrefixSkipper 检查请求路径是否包含指定的前缀,如果包含则跳过
Source Files ¶
Click to show internal directories.
Click to hide internal directories.