package auth import ( "time" "git.beisel.it/florian/hostname-service/config" "github.com/dgrijalva/jwt-go" ) func GenerateToken(username string) (string, error) { expirationTime := time.Now().Add(1 * time.Hour) claims := &jwt.StandardClaims{ Subject: username, ExpiresAt: expirationTime.Unix(), } token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims) tokenString, err := token.SignedString(config.GlobalConfig.JwtKey) return tokenString, err }