1 Star 0 Fork 0

dpnogo / iam

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
context.go 604 Bytes
一键复制 编辑 原始数据 按行查看 历史
dpnogo 提交于 2022-03-07 12:13 . 上层服务所使用的中间件
// Copyright 2020 Lingfei Kong <colin404@foxmail.com>. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package middleware
import (
"gitee.com/GomiTo/iam/pkg/log"
"github.com/gin-gonic/gin"
)
// UsernameKey defines the key in gin context which represents the owner of the secret.
const UsernameKey = "username"
func Context() gin.HandlerFunc { // 默认的中间件
return func(c *gin.Context) {
c.Set(log.KeyRequestID, c.GetString(XRequestIDKey))
c.Set(log.KeyUsername, c.GetString(UsernameKey))
c.Next()
}
}
1
https://gitee.com/GomiTo/iam.git
git@gitee.com:GomiTo/iam.git
GomiTo
iam
iam
455e706b39fb

搜索帮助