You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

21 lines
463 B

package authentication
import (
"errors"
"fmt"
"git.devices.local/mawas/golang-api-skeleton/lib/response"
"github.com/gin-gonic/gin"
)
// Authorized blocks unauthorized requestors
func Authorized(c *gin.Context) {
var resp response.Envelope
userID, exists := c.Get("userID")
if !exists {
c.AbortWithStatusJSON(403, resp.AppendError(errors.New("unauthorized")))
return
}
fmt.Println("permission check", userID)
// TODO add cache perm check here
}