fix ldap provider, disable gin logs by default
This commit is contained in:
parent
e1c7a43496
commit
9ef4200be0
|
@ -86,7 +86,7 @@ func (provider Provider) Login(ctx *authentication.AuthContext) (string, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(sr.Entries) != 1 {
|
if len(sr.Entries) != 1 {
|
||||||
return "", errors.Wrapf(err, "invalid amount of ldap entries (%d)", len(sr.Entries))
|
return "", errors.Errorf("invalid amount of ldap entries (%d)", len(sr.Entries))
|
||||||
}
|
}
|
||||||
|
|
||||||
userDN := sr.Entries[0].DN
|
userDN := sr.Entries[0].DN
|
||||||
|
@ -97,11 +97,11 @@ func (provider Provider) Login(ctx *authentication.AuthContext) (string, error)
|
||||||
switch provider.config.Type {
|
switch provider.config.Type {
|
||||||
case ldapconfig.TypeActiveDirectory:
|
case ldapconfig.TypeActiveDirectory:
|
||||||
if ldapconfig.IsActiveDirectoryUserDisabled(uac) {
|
if ldapconfig.IsActiveDirectoryUserDisabled(uac) {
|
||||||
return "", errors.Wrapf(err, "user is disabled")
|
return "", errors.New("user is disabled")
|
||||||
}
|
}
|
||||||
case ldapconfig.TypeOpenLDAP:
|
case ldapconfig.TypeOpenLDAP:
|
||||||
if ldapconfig.IsOpenLdapUserDisabled(uac) {
|
if ldapconfig.IsOpenLdapUserDisabled(uac) {
|
||||||
return "", errors.Wrapf(err, "user is disabled")
|
return "", errors.New("user is disabled")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,10 @@ func (s *Server) Setup(ctx context.Context) error {
|
||||||
gin.SetMode(gin.DebugMode)
|
gin.SetMode(gin.DebugMode)
|
||||||
gin.DefaultWriter = ioutil.Discard
|
gin.DefaultWriter = ioutil.Discard
|
||||||
s.server = gin.New()
|
s.server = gin.New()
|
||||||
s.server.Use(ginlogrus.Logger(logrus.StandardLogger()), gin.Recovery())
|
if logrus.GetLevel() == logrus.TraceLevel {
|
||||||
|
s.server.Use(ginlogrus.Logger(logrus.StandardLogger()))
|
||||||
|
}
|
||||||
|
s.server.Use(gin.Recovery())
|
||||||
s.server.SetFuncMap(template.FuncMap{
|
s.server.SetFuncMap(template.FuncMap{
|
||||||
"formatBytes": common.ByteCountSI,
|
"formatBytes": common.ByteCountSI,
|
||||||
"urlEncode": url.QueryEscape,
|
"urlEncode": url.QueryEscape,
|
||||||
|
|
Loading…
Reference in New Issue