Documentation ¶
Overview ¶
prometheus中间件
Index ¶
- Constants
- Variables
- func AdminAuthorizator(data interface{}, c *gin.Context) bool
- func AllUserAuthorizator(data interface{}, c *gin.Context) bool
- func Cors() gin.HandlerFunc
- func GetUserClaims(username string) ([]Claims, error)
- func Login(c *gin.Context)
- func Logout(c *gin.Context)
- func NewGinJwtMiddlewares(jwta JwtAuthorizator) *jwt.GinJWTMiddleware
- func NoRouteHandler(c *gin.Context)
- func PromHandler(handler http.Handler) gin.HandlerFunc
- func RefreshToken(c *gin.Context)
- func RegisterHealthMiddleware(c *gin.Context)
- func RegisterIndex(c *gin.Context)
- func RegisterJWT(router *gin.Engine)
- func RegisterNodeExporter(router *gin.Engine)
- func RegisterPrometheusMiddleware(router *gin.Engine, isauth bool)
- func RegisterPrometheusMiddlewareBasic(router *gin.Engine, isauth bool)
- func RegisterSwaggerMiddleware(router *gin.Engine)
- func RegisterUrlCache(router *gin.Engine)
- func TestAuthorizator(data interface{}, c *gin.Context) bool
- func VerifyAuth(username, password string) (bool, error)
- func VerifyAuthByRancher(username, password string) (string, string, bool)
- type IdentityKey
- type JwtAuthorizator
Constants ¶
const ( LabelValueTenantPlatform = "platform" XForwardedUri = "X-Forwarded-Uri" XForwardedMethod = "X-Forwarded-Method" XForwardedHost = "X-Forwarded-Host" XForwardedProto = "X-Forwarded-Proto" )
Variables ¶
var ( URLCACHE_GET string = "/apis/v1/urlcache/:name" URLCACHEALL_GET string = "/apis/v1/urlcache" URLCACHE_FORWARDAUTH string = "/forwardauth" )
var (
IsRancherLogin bool
)
var NoRoutePath string = "/admin/index"
默认404跳转地址
var WhilteList []string = []string{
"URLCACHE_GET", "URLCACHEALL_GET", "URLCACHE_FORWARDAUTH",
}
平台级别白名单列表
Functions ¶
func AdminAuthorizator ¶ added in v0.2.2
role is admin can access
func AllUserAuthorizator ¶ added in v0.2.2
不限制用户权限
func Login ¶ added in v0.2.2
@Summary 通用接口 @Description 登陆、swagger、注销、404等 @Tags Auth @Param token query string false "token" @Param data body User true "data" @Success 200 {string} string "success" @Security ApiKeyAuth @Router /auth/login [post]
func Logout ¶ added in v0.2.2
@Summary 通用接口 @Description 登陆、swagger、注销、404等 @Tags Auth @Success 200 {string} string "success" @Security ApiKeyAuth @Router /auth/logout [get]
func NewGinJwtMiddlewares ¶ added in v0.2.2
func NewGinJwtMiddlewares(jwta JwtAuthorizator) *jwt.GinJWTMiddleware
根据不同接口的权限规则生成不同权限的jwt中间件
func PromHandler ¶
func PromHandler(handler http.Handler) gin.HandlerFunc
func RefreshToken ¶ added in v0.2.2
@Summary 通用接口 @Description 登陆、swagger、注销、404等 @Tags Auth @Success 200 {string} string "success" @Security ApiKeyAuth @Router /auth/refreshtoken [get]
func RegisterHealthMiddleware ¶
@Summary 健康检查 @Description 接口健康检查接口 @Tags Health @Success 200 {string} string "success" @Router /health [get]
func RegisterIndex ¶
func RegisterNodeExporter ¶ added in v0.2.2
func RegisterPrometheusMiddleware ¶
默认prometheus监控+自定义监控
func RegisterPrometheusMiddlewareBasic ¶ added in v0.2.5
默认prometheus监控+自定义监控
func TestAuthorizator ¶ added in v0.2.2
username is test can access
Types ¶
type IdentityKey ¶ added in v0.2.2
type IdentityKey string
type JwtAuthorizator ¶ added in v0.2.2
接口权限