Skip to content

Commit 1f515eb

Browse files
committed
options bug fixes; set https cookies on by default
1 parent ba7aee9 commit 1f515eb

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func main() {
3737
flagSet.String("cookie-secret", "", "the seed string for secure cookies")
3838
flagSet.String("cookie-domain", "", "an optional cookie domain to force cookies to (ie: .yourcompany.com)*")
3939
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")
4141

4242
flagSet.Parse(os.Args[1:])
4343

oauthproxy.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ func NewOauthProxy(opts *Options, validator func(string) bool) *OauthProxy {
5555
redirectUrl.Path = oauthCallbackPath
5656

5757
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)
5863
return &OauthProxy{
5964
CookieKey: "_oauthproxy",
6065
CookieSeed: opts.CookieSecret,

options.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ type Options struct {
2929
}
3030

3131
func 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+
}
3338
}
3439

3540
func (o *Options) Validate() error {

0 commit comments

Comments
 (0)