Upstream sync

This commit is contained in:
Senad Uka
2023-09-18 12:27:40 +02:00
parent 9750aa2c37
commit 1f30f85787
30 changed files with 309 additions and 150 deletions

View File

@@ -13,16 +13,15 @@ import (
type AuthController struct{}
func (AuthController)HandleLogin(c *gin.Context) {
userId:="123"
username:="Beast"
roles:= []string{shared.RoleAdmin, shared.RoleProUser}
func (AuthController) HandleLogin(c *gin.Context) {
userId := "123"
username := "Beast"
roles := []string{shared.RoleAdmin, shared.RoleProUser}
// do user auth here
//issue token
token, err := middlewares.GenerateToken([]byte(middlewares.SigningKey), userId,username, roles)
token, err := middlewares.GenerateToken([]byte(middlewares.SigningKey), userId, username, roles)
if err != nil {
log.Printf("Unable to generate token %v", err)
c.JSON(http.StatusInternalServerError, err)