diff --git a/server/handlers/app.go b/server/handlers/app.go index 5b34fb6..6c5d541 100644 --- a/server/handlers/app.go +++ b/server/handlers/app.go @@ -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, diff --git a/server/main.go b/server/main.go index f0b544a..fa397c8 100644 --- a/server/main.go +++ b/server/main.go @@ -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)