From 92718acf16fac98c8a79f63edf97a9685b68487e Mon Sep 17 00:00:00 2001 From: Peter Sanchez Date: Sat, 29 Apr 2023 00:30:20 -0600 Subject: [PATCH] Fixing json introspect output --- routes.go | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/routes.go b/routes.go index 35f7e05..3b43b4c 100644 --- a/routes.go +++ b/routes.go @@ -87,45 +87,45 @@ func (s *Service) Introspect(c echo.Context) error { ctype := req.Header.Get("Content-Type") if ctype != "application/x-www-form-urlencoded" { retErr := struct { - err string `json:"error"` - desc string `json:"error_description"` - uri string `json:"error_url"` // TODO Make this customizable + Err string `json:"error"` + Desc string `json:"error_description"` + URI string `json:"error_url"` // TODO Make this customizable }{ - err: "invalid request", - desc: "Content-Type must be application/x-www-form-urlencoded", + Err: "invalid request", + Desc: "Content-Type must be application/x-www-form-urlencoded", } return c.JSON(http.StatusBadRequest, &retErr) } retFalse := struct { - active bool `json:"active"` + Active bool `json:"active"` }{false} token := ForContext(req.Context()) if token == nil { - return c.JSON(http.StatusOK, retFalse) + return c.JSON(http.StatusOK, &retFalse) } if token.Token.ClientID == "" { - return c.JSON(http.StatusOK, retFalse) + return c.JSON(http.StatusOK, &retFalse) } ret := struct { - active bool `json:"active"` - clientID string `json:"client_id"` - username string `json:"username"` - tokenType string `json:"token_type"` - exp int `json:"exp"` - iat int `json:"iat"` + Active bool `json:"active"` + ClientID string `json:"client_id"` + Username string `json:"username"` + TokenType string `json:"token_type"` + Exp int `json:"exp"` + Iat int `json:"iat"` }{ - active: true, - clientID: token.Token.ClientID, - username: token.User.GetEmail(), - tokenType: "bearer", - exp: int(token.Token.Expires), - iat: int(token.Token.Issued), + Active: true, + ClientID: token.Token.ClientID, + Username: token.User.GetEmail(), + TokenType: "bearer", + Exp: int(token.Token.Expires), + Iat: int(token.Token.Issued), } - return c.JSON(http.StatusOK, ret) + return c.JSON(http.StatusOK, &ret) } // RouteName ... -- 2.45.2