security/controller.go
func (c *AuthController) Authenticate(w http.ResponseWriter, r *http.Request) {
	decoder := json.NewDecoder(r.Body)
	var user User
	var data map[string]string
	err := decoder.Decode(&user)
	if err != nil {
		http.Error(w, fmt.Sprintf("%v", err), 400)
		return
	}
	user, _ = c.UserManager.Get(user.Username, user.Password)
	if user.Username != "" {
		token := jwt.New(jwt.GetSigningMethod("HS256"))
		claims := token.Claims.(jwt.MapClaims)

		claims["username"] = user.Username
		claims["email"] = user.Email
		claims["exp"] = time.Now().Add(time.Minute * 10).Unix()
		tokenString, _ := token.SignedString([]byte(c.cnf.Jwt.Key))
		data = map[string]string{
			"id_token": tokenString,
		}
	}
	js, _ := json.Marshal(data)
	w.Write(js)
}
func (c *AuthController) Authenticate(w http.ResponseWriter, r *http.Request) {
	decoder := json.NewDecoder(r.Body)
	var user User
	var data map[string]string
	err := decoder.Decode(&user)
	if err != nil {
		http.Error(w, fmt.Sprintf("%v", err), 400)
		return
	}
	user, _ = c.UserManager.Get(user.Username, user.Password)
	if user.Username != "" {
		token := jwt.New(jwt.GetSigningMethod("HS256"))
		claims := token.Claims.(jwt.MapClaims)

		claims["username"] = user.Username
		claims["email"] = user.Email
		claims["exp"] = time.Now().Add(time.Minute * 10).Unix()
		tokenString, _ := token.SignedString([]byte(c.cnf.Jwt.Key))
		data = map[string]string{
			"id_token": tokenString,
		}
	}
	js, _ := json.Marshal(data)
	w.Write(js)
}
//Authenticate controls authorizations