first try
This commit is contained in:
17
controllers/authController.go
Normal file
17
controllers/authController.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"gitea.tbdevent.eu/TBD/reforger_crawler_main/initializers"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func CheckAllowed(c *gin.Context) {
|
||||
secret := c.GetHeader("X-SECRET-KEY")
|
||||
if secret != initializers.SECRET {
|
||||
c.JSON(http.StatusForbidden, gin.H{"error": "Forbidden"})
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user