upgrade 2.4.1: bugfix: default token
This commit is contained in:
parent
834669bf36
commit
a366f14434
2
control
2
control
|
@ -1,7 +1,7 @@
|
|||
#!/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()
|
||||
|
|
Loading…
Reference in New Issue