middlewares

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

prometheus中间件

Index

Constants

This section is empty.

Variables

View Source
var (
	IsRancherLogin bool
)

Functions

func AddWhiteRouter added in v0.0.3

func AddWhiteRouter(data ...string)

func AdminAuthorizator

func AdminAuthorizator(data interface{}, c *gin.Context) bool

role is admin can access

func AllUserAuthorizator

func AllUserAuthorizator(data interface{}, c *gin.Context) bool

不限制用户权限

func Cors

func Cors() gin.HandlerFunc

跨域设置

func GetUserClaims

func GetUserClaims(username string) ([]Claims, error)

获取用户权限列表

func JwtTokenFilter added in v0.0.4

func JwtTokenFilter() gin.HandlerFunc

func Login

func Login(c *gin.Context)

@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

func Logout(c *gin.Context)

@Summary 通用接口 @Description 登陆、swagger、注销、404等 @Tags Auth @Success 200 {string} string "success" @Security ApiKeyAuth @Router /auth/logout [get]

func NewGinJwtMiddlewares

func NewGinJwtMiddlewares(jwta JwtAuthorizator) *jwt.GinJWTMiddleware

根据不同接口的权限规则生成不同权限的jwt中间件

func NoRouteHandler

func NoRouteHandler(c *gin.Context)

404 handler

func PromHandler

func PromHandler(handler http.Handler) gin.HandlerFunc

func RefreshToken

func RefreshToken(c *gin.Context)

@Summary 通用接口 @Description 登陆、swagger、注销、404等 @Tags Auth @Success 200 {string} string "success" @Security ApiKeyAuth @Router /auth/refreshtoken [get]

func RegisterHealthMiddleware

func RegisterHealthMiddleware(c *gin.Context)

@Summary 健康检查 @Description 接口健康检查接口 @Tags Health @Success 200 {string} string "success" @Router /health [get]

func RegisterIndex added in v0.0.3

func RegisterIndex(c *gin.Context)

func RegisterJWT added in v0.0.3

func RegisterJWT()

注册auth

func RegisterPrometheusMiddleware

func RegisterPrometheusMiddleware(router *dogo.Rails, isauth bool)

默认prometheus监控+自定义监控

func RegisterSwaggerMiddleware

func RegisterSwaggerMiddleware(router *dogo.Rails)

func TestAuthorizator

func TestAuthorizator(data interface{}, c *gin.Context) bool

username is test can access

func TokenFilter

func TokenFilter() gin.HandlerFunc

func VerifyAuth

func VerifyAuth(username, password string) (bool, error)

验证用户密码

func VerifyAuthByRancher

func VerifyAuthByRancher(username, password string) (string, string, bool)

Types

type IdentityKey

type IdentityKey string

type JwtAuthorizator

type JwtAuthorizator func(data interface{}, c *gin.Context) bool

接口权限

Jump to

Keyboard shortcuts

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