19 lines
407 B
Go
19 lines
407 B
Go
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
|
|
}
|