diff options
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -5,16 +5,16 @@ import ( | |||
5 | "crypto/rand" | 5 | "crypto/rand" |
6 | "encoding/hex" | 6 | "encoding/hex" |
7 | "flag" | 7 | "flag" |
8 | "github.com/golang/glog" | ||
9 | "github.com/gorilla/handlers" | ||
10 | "github.com/pkg/errors" | ||
11 | "net/http" | 8 | "net/http" |
12 | "net/http/httputil" | 9 | "net/http/httputil" |
13 | "net/url" | 10 | "net/url" |
14 | "os" | 11 | "os" |
15 | "strconv" | ||
16 | "strings" | 12 | "strings" |
17 | "time" | 13 | "time" |
14 | |||
15 | "github.com/golang/glog" | ||
16 | "github.com/gorilla/handlers" | ||
17 | "github.com/pkg/errors" | ||
18 | ) | 18 | ) |
19 | 19 | ||
20 | const ( | 20 | const ( |
@@ -238,10 +238,8 @@ func AuthProxyController(w http.ResponseWriter, r *http.Request) { | |||
238 | } | 238 | } |
239 | 239 | ||
240 | r.Header["X-Forwarded-User"] = []string{claims.Subject} | 240 | r.Header["X-Forwarded-User"] = []string{claims.Subject} |
241 | r.Header["X-Forwarded-Token-Expires"] = []string{strconv.FormatInt(int64(claims.Expiry), 10)} | 241 | r.Header["X-Forwarded-Token-Age"] = StringListFromInt(claims.Age()) |
242 | 242 | r.Header["X-Forwarded-Token-Expires"] = StringListFromInt(int64(claims.Expiry)) | |
243 | age := time.Since(claims.IssuedAt.Time()).Minutes() | ||
244 | r.Header["X-Forwarded-Token-Age"] = []string{strconv.FormatInt(int64(age), 10)} | ||
245 | 243 | ||
246 | ctx.reverseProxy.ServeHTTP(w, r) | 244 | ctx.reverseProxy.ServeHTTP(w, r) |
247 | } | 245 | } |