Skip to content
This repository has been archived by the owner on Jan 24, 2019. It is now read-only.

Commit

Permalink
options bug fixes; set https cookies on by default
Browse files Browse the repository at this point in the history
  • Loading branch information
jehiah committed Nov 10, 2014
1 parent ba7aee9 commit 1f515eb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func main() {
flagSet.String("cookie-secret", "", "the seed string for secure cookies")
flagSet.String("cookie-domain", "", "an optional cookie domain to force cookies to (ie: .yourcompany.com)*")
flagSet.Duration("cookie-expire", time.Duration(168)*time.Hour, "expire timeframe for cookie")
flagSet.Bool("cookie-https-only", false, "set HTTPS only cookie")
flagSet.Bool("cookie-https-only", true, "set HTTPS only cookie")

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

Expand Down
5 changes: 5 additions & 0 deletions oauthproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ func NewOauthProxy(opts *Options, validator func(string) bool) *OauthProxy {
redirectUrl.Path = oauthCallbackPath

log.Printf("OauthProxy configured for %s", opts.ClientID)
domain := opts.CookieDomain
if domain == "" {
domain = "<default>"
}
log.Printf("Cookie settings: https_only: %v expiry: %s domain:%s", opts.CookieHttpsOnly, opts.CookieExpire, domain)
return &OauthProxy{
CookieKey: "_oauthproxy",
CookieSeed: opts.CookieSecret,
Expand Down
7 changes: 6 additions & 1 deletion options.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ type Options struct {
}

func NewOptions() *Options {
return &Options{}
return &Options{
HttpAddress: "127.0.0.1:4180",
CookieHttpsOnly: true,
PassBasicAuth: true,
CookieExpire: time.Duration(168) * time.Hour,
}
}

func (o *Options) Validate() error {
Expand Down

0 comments on commit 1f515eb

Please sign in to comment.