完善初始化更新
This commit is contained in:
18
sproutgate-backend/internal/handlers/auth_client.go
Normal file
18
sproutgate-backend/internal/handlers/auth_client.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"sproutgate-backend/internal/models"
|
||||
)
|
||||
|
||||
func authClientFromHeaders(c *gin.Context) (id string, name string, ok bool) {
|
||||
id, ok = models.NormalizeAuthClientID(strings.TrimSpace(c.GetHeader("X-Auth-Client")))
|
||||
if !ok {
|
||||
return "", "", false
|
||||
}
|
||||
name = models.ClampAuthClientName(c.GetHeader("X-Auth-Client-Name"))
|
||||
return id, name, true
|
||||
}
|
||||
Reference in New Issue
Block a user