Auth: Support for user authentication via reverse proxy header (like X-Authenticated-User, or X-WEBAUTH-USER), Closes #1921

This commit is contained in:
Torkel Ödegaard
2015-05-02 12:06:58 +02:00
parent ba883d25fe
commit be589d81c7
7 changed files with 182 additions and 13 deletions
+1 -2
View File
@@ -1,7 +1,6 @@
package middleware
import (
"fmt"
"strconv"
"strings"
@@ -41,6 +40,7 @@ func GetContextHandler() macaron.Handler {
// then look for api key in session (special case for render calls via api)
// then test if anonymous access is enabled
if initContextWithApiKey(ctx) ||
initContextWithAuthProxy(ctx) ||
initContextWithUserSessionCookie(ctx) ||
initContextWithApiKeyFromSession(ctx) ||
initContextWithAnonymousUser(ctx) {
@@ -79,7 +79,6 @@ func initContextWithUserSessionCookie(ctx *Context) bool {
var userId int64
if userId = getRequestUserId(ctx); userId == 0 {
fmt.Printf("Not userId")
return false
}