提交 a366f144 编写于 作者: U UlricQin

upgrade 2.4.1: bugfix: default token

上级 834669bf
#!/bin/bash
# release version
version=2.4.0
version=2.4.1
CWD=$(cd $(dirname $0)/; pwd)
cd $CWD
......
......@@ -70,11 +70,13 @@ func headerUser(c *gin.Context) string {
return pair[0]
}
const internalToken = "monapi-builtin-token"
// CheckHeaderToken check thirdparty x-srv-token
func CheckHeaderToken() gin.HandlerFunc {
return func(c *gin.Context) {
token := c.GetHeader("x-srv-token")
if !slice.ContainsString(config.Get().Tokens, token) {
if token != internalToken && !slice.ContainsString(config.Get().Tokens, token) {
errors.Bomb("token[%s] invalid", token)
}
c.Next()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册