Skip to content

Commit

Permalink
fix: Allow the manual setting user id to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
sirateek committed Apr 21, 2023
1 parent 77a15f0 commit 928e90a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion httpserver/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ import (

func AuthModelMapping() gin.HandlerFunc {
return func(c *gin.Context) {
key := c.GetHeader(UserUidKey)
currentUserId := c.GetHeader(UserUidKey)
if currentUserId != "" {
c.Next()
return
}

key := c.GetHeader("Authorization")

splittedKey := strings.Split(key, " ")
if len(splittedKey) != 2 {
c.AbortWithStatus(http.StatusForbidden)
Expand Down

0 comments on commit 928e90a

Please sign in to comment.