mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-06-04 11:25:52 +08:00
Cleanup rbac.go
This commit is contained in:
parent
797352583a
commit
b0f62daa24
@ -3,7 +3,6 @@ package auth
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"go.signoz.io/signoz/pkg/query-service/constants"
|
"go.signoz.io/signoz/pkg/query-service/constants"
|
||||||
@ -49,19 +48,6 @@ func InitAuthCache(ctx context.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetAuthorizationToken(r *http.Request) string {
|
|
||||||
authHeader := r.Header.Get("Authorization")
|
|
||||||
if authHeader == "" {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
authHeaderParts := strings.Fields(authHeader)
|
|
||||||
if len(authHeaderParts) != 2 || strings.ToLower(authHeaderParts[0]) != "bearer" {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return authHeaderParts[1]
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetUserFromRequest(r *http.Request) (*model.UserPayload, error) {
|
func GetUserFromRequest(r *http.Request) (*model.UserPayload, error) {
|
||||||
accessJwt, err := ExtractJwtFromRequest(r)
|
accessJwt, err := ExtractJwtFromRequest(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user