fix(server): linting issues
This commit is contained in:
parent
d8eceadd7f
commit
094782aeca
|
@ -30,7 +30,7 @@ func AppHandler() gin.HandlerFunc {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
redirect_uri := strings.TrimSpace(c.Query("redirect_uri"))
|
redirectURI := strings.TrimSpace(c.Query("redirect_uri"))
|
||||||
state := strings.TrimSpace(c.Query("state"))
|
state := strings.TrimSpace(c.Query("state"))
|
||||||
scopeString := strings.TrimSpace(c.Query("scope"))
|
scopeString := strings.TrimSpace(c.Query("scope"))
|
||||||
|
|
||||||
|
@ -41,11 +41,11 @@ func AppHandler() gin.HandlerFunc {
|
||||||
scope = strings.Split(scopeString, " ")
|
scope = strings.Split(scopeString, " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
if redirect_uri == "" {
|
if redirectURI == "" {
|
||||||
redirect_uri = hostname + "/app"
|
redirectURI = hostname + "/app"
|
||||||
} else {
|
} else {
|
||||||
// validate redirect url with allowed origins
|
// validate redirect url with allowed origins
|
||||||
if !validators.IsValidOrigin(redirect_uri) {
|
if !validators.IsValidOrigin(redirectURI) {
|
||||||
log.Debug("Invalid redirect_uri")
|
log.Debug("Invalid redirect_uri")
|
||||||
c.JSON(400, gin.H{"error": "invalid redirect url"})
|
c.JSON(400, gin.H{"error": "invalid redirect url"})
|
||||||
return
|
return
|
||||||
|
@ -75,7 +75,7 @@ func AppHandler() gin.HandlerFunc {
|
||||||
c.HTML(http.StatusOK, "app.tmpl", gin.H{
|
c.HTML(http.StatusOK, "app.tmpl", gin.H{
|
||||||
"data": map[string]interface{}{
|
"data": map[string]interface{}{
|
||||||
"authorizerURL": hostname,
|
"authorizerURL": hostname,
|
||||||
"redirectURL": redirect_uri,
|
"redirectURL": redirectURI,
|
||||||
"scope": scope,
|
"scope": scope,
|
||||||
"state": state,
|
"state": state,
|
||||||
"organizationName": orgName,
|
"organizationName": orgName,
|
||||||
|
|
|
@ -15,12 +15,15 @@ import (
|
||||||
"github.com/authorizerdev/authorizer/server/routes"
|
"github.com/authorizerdev/authorizer/server/routes"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// VERSION is used to define the version of authorizer from build tags
|
||||||
var VERSION string
|
var VERSION string
|
||||||
|
|
||||||
|
// LogUTCFormatter hels in setting UTC time format for the logs
|
||||||
type LogUTCFormatter struct {
|
type LogUTCFormatter struct {
|
||||||
log.Formatter
|
log.Formatter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Format helps fomratting time to UTC
|
||||||
func (u LogUTCFormatter) Format(e *log.Entry) ([]byte, error) {
|
func (u LogUTCFormatter) Format(e *log.Entry) ([]byte, error) {
|
||||||
e.Time = e.Time.UTC()
|
e.Time = e.Time.UTC()
|
||||||
return u.Formatter.Format(e)
|
return u.Formatter.Format(e)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user