git.iko.soy/typeable/oauth2-proxy
on master help sign in
options bug fixes; set https cookies on by default
1f515ebJehiah Czebotar
main.go+1−1
@@ -37,7 +37,7 @@ func main() {
37 flagSet.String("cookie-secret", "", "the seed string for secure cookies")
37 flagSet.String("cookie-secret", "", "the seed string for secure cookies")
38 flagSet.String("cookie-domain", "", "an optional cookie domain to force cookies to (ie: .yourcompany.com)*")
38 flagSet.String("cookie-domain", "", "an optional cookie domain to force cookies to (ie: .yourcompany.com)*")
39 flagSet.Duration("cookie-expire", time.Duration(168)*time.Hour, "expire timeframe for cookie")
39 flagSet.Duration("cookie-expire", time.Duration(168)*time.Hour, "expire timeframe for cookie")
40− flagSet.Bool("cookie-https-only", false, "set HTTPS only cookie")
40+ flagSet.Bool("cookie-https-only", true, "set HTTPS only cookie")
41
41
42 flagSet.Parse(os.Args[1:])
42 flagSet.Parse(os.Args[1:])
43
43
oauthproxy.go+5
@@ -55,6 +55,11 @@ func NewOauthProxy(opts *Options, validator func(string) bool) *OauthProxy {
55 redirectUrl.Path = oauthCallbackPath
55 redirectUrl.Path = oauthCallbackPath
56
56
57 log.Printf("OauthProxy configured for %s", opts.ClientID)
57 log.Printf("OauthProxy configured for %s", opts.ClientID)
58+ domain := opts.CookieDomain
59+ if domain == "" {
60+ domain = "<default>"
61+ }
62+ log.Printf("Cookie settings: https_only: %v expiry: %s domain:%s", opts.CookieHttpsOnly, opts.CookieExpire, domain)
58 return &OauthProxy{
63 return &OauthProxy{
59 CookieKey: "_oauthproxy",
64 CookieKey: "_oauthproxy",
60 CookieSeed: opts.CookieSecret,
65 CookieSeed: opts.CookieSecret,
options.go+6−1
@@ -29,7 +29,12 @@ type Options struct {
29}
29}
30
30
31func NewOptions() *Options {
31func NewOptions() *Options {
32− return &Options{}
32+ return &Options{
33+ HttpAddress: "127.0.0.1:4180",
34+ CookieHttpsOnly: true,
35+ PassBasicAuth: true,
36+ CookieExpire: time.Duration(168) * time.Hour,
37+ }
33}
38}
34
39
35func (o *Options) Validate() error {
40func (o *Options) Validate() error {