Commit 38fc85d6 by Torkel Ödegaard

Final tweaks to auth proxy feature

parent be589d81
......@@ -164,7 +164,7 @@ allowed_domains =
#################################### Auth Proxy ##########################
[auth.proxy]
enabled = false;
enabled = false
header_name = X-WEBAUTH-USER
header_property = username
auto_sign_up = true
......
......@@ -161,6 +161,13 @@
;api_url = https://www.googleapis.com/oauth2/v1/userinfo
;allowed_domains =
#################################### Auth Proxy ##########################
[auth.proxy]
;enabled = false
;header_name = X-WEBAUTH-USER
;header_property = username
;auto_sign_up = true
#################################### Logging ##########################
[log]
# Either "console", "file", default is "console"
......
......@@ -12,7 +12,7 @@ func initContextWithAuthProxy(ctx *Context) bool {
}
proxyHeaderValue := ctx.Req.Header.Get(setting.AuthProxyHeaderName)
if len(proxyHeaderValue) <= 0 {
if len(proxyHeaderValue) == 0 {
return false
}
......@@ -34,6 +34,8 @@ func initContextWithAuthProxy(ctx *Context) bool {
ctx.Handle(500, "Failed find user after creation", err)
return true
}
} else {
return false
}
}
......
......@@ -265,17 +265,17 @@ func GetSignedInUser(query *m.GetSignedInUserQuery) error {
LEFT OUTER JOIN org_user on org_user.org_id = u.org_id and org_user.user_id = u.id
LEFT OUTER JOIN org on org.id = u.org_id `
sess := x.Table("user")
if query.UserId > 0 {
rawSql += "WHERE u.id=?"
sess.Sql(rawSql+"WHERE u.id=?", query.UserId)
} else if query.Login != "" {
rawSql += "WHERE u.login=?"
sess.Sql(rawSql+"WHERE u.login=?", query.Login)
} else if query.Email != "" {
rawSql += "WHERE u.email=?"
sess.Sql(rawSql+"WHERE u.email=?", query.Email)
}
var user m.SignedInUser
sess := x.Table("user")
has, err := sess.Sql(rawSql, query.UserId).Get(&user)
has, err := sess.Get(&user)
if err != nil {
return err
} else if !has {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment