diff options
author | Mike Crute <mike@crute.us> | 2017-09-19 04:39:36 +0000 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2019-05-21 13:41:00 +0000 |
commit | deb76405de56956bb14804286db503462d30bc12 (patch) | |
tree | 37779320722273608144b67c449a374cdd6a55eb /main.go | |
parent | 9f7861ffe1397da514606b189f5b3e383f4e7ed7 (diff) | |
download | oidc_proxy-deb76405de56956bb14804286db503462d30bc12.tar.bz2 oidc_proxy-deb76405de56956bb14804286db503462d30bc12.tar.xz oidc_proxy-deb76405de56956bb14804286db503462d30bc12.zip |
Finish out most of the proxy functionality
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 | } |