mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 02:29:03 +08:00
Change header name
This commit is contained in:
parent
b0f62daa24
commit
df7f276f03
@ -203,14 +203,14 @@ func (s *Server) createPrivateServer(apiHandler *api.APIHandler) (*http.Server,
|
||||
}
|
||||
|
||||
func getPATToken(r *http.Request) (string, error) {
|
||||
authHeader := r.Header.Get("Authorization")
|
||||
if authHeader == "" {
|
||||
patHeader := r.Header.Get("SIGNOZ-API-KEY")
|
||||
if patHeader == "" {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
authHeaderParts := strings.Fields(authHeader)
|
||||
authHeaderParts := strings.Fields(patHeader)
|
||||
if len(authHeaderParts) != 2 || strings.ToLower(authHeaderParts[0]) != "bearer" {
|
||||
return "", fmt.Errorf("authorization header format must be Bearer {token}")
|
||||
return "", fmt.Errorf("PAT authorization header format must be bearer {token}")
|
||||
}
|
||||
|
||||
return authHeaderParts[1], nil
|
||||
|
@ -19,10 +19,6 @@ func NewAuthMiddleware(f func(r *http.Request) (*model.UserPayload, error)) *Aut
|
||||
}
|
||||
}
|
||||
|
||||
// func (am *AuthMiddleware) GetUserFromRequest(r *http.Request) (*model.UserPayload, error) {
|
||||
// return auth.GetUserFromRequest(r)
|
||||
// }
|
||||
|
||||
func (am *AuthMiddleware) OpenAccess(f func(http.ResponseWriter, *http.Request)) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
f(w, r)
|
||||
|
Loading…
x
Reference in New Issue
Block a user