aboutsummaryrefslogtreecommitdiff
path: root/backend/api/auth.go
diff options
context:
space:
mode:
authorArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2023-08-26 08:53:24 +0300
committerArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2023-08-26 08:53:24 +0300
commitf1b7589b2936335957a6a1da1eea3d66233ad0ce (patch)
tree1975af217c190f5dbdb23b96015cef45206302d4 /backend/api/auth.go
parentdocs: profile improvement swagger (#51) (diff)
downloadlphub-f1b7589b2936335957a6a1da1eea3d66233ad0ce.tar.gz
lphub-f1b7589b2936335957a6a1da1eea3d66233ad0ce.tar.bz2
lphub-f1b7589b2936335957a6a1da1eea3d66233ad0ce.zip
refactor: reorganizing packages
Former-commit-id: 99410223654c2a5ffc15fdab6ec3e921b5410cba
Diffstat (limited to '')
-rw-r--r--backend/api/auth.go (renamed from backend/middleware/auth.go)4
1 files changed, 2 insertions, 2 deletions
diff --git a/backend/middleware/auth.go b/backend/api/auth.go
index e2c84fa..91ef80c 100644
--- a/backend/middleware/auth.go
+++ b/backend/api/auth.go
@@ -1,4 +1,4 @@
1package middleware 1package api
2 2
3import ( 3import (
4 "fmt" 4 "fmt"
@@ -16,7 +16,7 @@ func CheckAuth(c *gin.Context) {
16 // Validate token 16 // Validate token
17 token, err := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) { 17 token, err := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) {
18 if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok { 18 if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {
19 return nil, fmt.Errorf("Unexpected signing method: %v", token.Header["alg"]) 19 return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"])
20 } 20 }
21 return []byte(os.Getenv("SECRET_KEY")), nil 21 return []byte(os.Getenv("SECRET_KEY")), nil
22 }) 22 })