Compare commits
2 Commits
v0.3.0
...
31eed99025
| Author | SHA1 | Date | |
|---|---|---|---|
|
31eed99025
|
|||
|
6c9eab09e2
|
10
auth.go
10
auth.go
@@ -21,10 +21,12 @@ func handleAuth(c *gin.Context) error {
|
|||||||
authorization = strings.Trim(authorization[len("Bearer"):], " ")
|
authorization = strings.Trim(authorization[len("Bearer"):], " ")
|
||||||
log.Println("Received authorization", authorization)
|
log.Println("Received authorization", authorization)
|
||||||
|
|
||||||
if authorization != authConfig.Value {
|
for _, auth := range strings.Split(authConfig.Value, ",") {
|
||||||
err = errors.New("wrong authorization header")
|
if authorization != strings.Trim(auth, " ") {
|
||||||
c.AbortWithError(403, err)
|
err = errors.New("wrong authorization header")
|
||||||
return err
|
c.AbortWithError(403, err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ func processRequest(c *gin.Context, upstream *OPENAI_UPSTREAM, record *Record, s
|
|||||||
|
|
||||||
record.UpstreamID = upstream.ID
|
record.UpstreamID = upstream.ID
|
||||||
record.Response = ""
|
record.Response = ""
|
||||||
record.Authorization = upstream.SK
|
|
||||||
// [TODO] record request body
|
// [TODO] record request body
|
||||||
|
|
||||||
// reverse proxy
|
// reverse proxy
|
||||||
|
|||||||
Reference in New Issue
Block a user