fix(server): linting issues

This commit is contained in:
Lakhan Samani 2022-10-21 11:19:32 +05:30
parent d8eceadd7f
commit 094782aeca
2 changed files with 8 additions and 5 deletions

View File

@ -30,7 +30,7 @@ func AppHandler() gin.HandlerFunc {
return
}
redirect_uri := strings.TrimSpace(c.Query("redirect_uri"))
redirectURI := strings.TrimSpace(c.Query("redirect_uri"))
state := strings.TrimSpace(c.Query("state"))
scopeString := strings.TrimSpace(c.Query("scope"))
@ -41,11 +41,11 @@ func AppHandler() gin.HandlerFunc {
scope = strings.Split(scopeString, " ")
}
if redirect_uri == "" {
redirect_uri = hostname + "/app"
if redirectURI == "" {
redirectURI = hostname + "/app"
} else {
// validate redirect url with allowed origins
if !validators.IsValidOrigin(redirect_uri) {
if !validators.IsValidOrigin(redirectURI) {
log.Debug("Invalid redirect_uri")
c.JSON(400, gin.H{"error": "invalid redirect url"})
return
@ -75,7 +75,7 @@ func AppHandler() gin.HandlerFunc {
c.HTML(http.StatusOK, "app.tmpl", gin.H{
"data": map[string]interface{}{
"authorizerURL": hostname,
"redirectURL": redirect_uri,
"redirectURL": redirectURI,
"scope": scope,
"state": state,
"organizationName": orgName,

View File

@ -15,12 +15,15 @@ import (
"github.com/authorizerdev/authorizer/server/routes"
)
// VERSION is used to define the version of authorizer from build tags
var VERSION string
// LogUTCFormatter hels in setting UTC time format for the logs
type LogUTCFormatter struct {
log.Formatter
}
// Format helps fomratting time to UTC
func (u LogUTCFormatter) Format(e *log.Entry) ([]byte, error) {
e.Time = e.Time.UTC()
return u.Formatter.Format(e)