@@ -47,7 +47,6 @@ type OauthProxy struct {
4747 DisplayHtpasswdForm bool
4848 serveMux http.Handler
4949 PassBasicAuth bool
50− PassAccessToken bool
5150 AesCipher cipher.Block
5251 skipAuthRegex []string
5352 compiledRegex []*regexp.Regexp
@@ -121,20 +120,7 @@ func NewOauthProxy(opts *Options, validator func(string) bool) *OauthProxy {
121120 log.Printf("Cookie settings: secure (https):%v httponly:%v expiry:%s domain:%s", opts.CookieSecure, opts.CookieHttpOnly, opts.CookieExpire, domain)
122121
123122 var aes_cipher cipher.Block
124−
125− if opts.PassAccessToken == true {
126− valid_cookie_secret_size := false
127− for _, i := range []int{16, 24, 32} {
128− if len(opts.CookieSecret) == i {
129− valid_cookie_secret_size = true
130− }
131− }
132− if valid_cookie_secret_size == false {
133− log.Fatal("cookie_secret must be 16, 24, or 32 bytes " +
134− "to create an AES cipher when " +
135− "pass_access_token == true")
136− }
137−
123+ if opts.PassAccessToken {
138124 var err error
139125 aes_cipher, err = aes.NewCipher([]byte(opts.CookieSecret))
140126 if err != nil {
@@ -163,7 +149,6 @@ func NewOauthProxy(opts *Options, validator func(string) bool) *OauthProxy {
163149 skipAuthRegex: opts.SkipAuthRegex,
164150 compiledRegex: opts.CompiledRegex,
165151 PassBasicAuth: opts.PassBasicAuth,
166− PassAccessToken: opts.PassAccessToken,
167152 AesCipher: aes_cipher,
168153 templates: loadTemplates(opts.CustomTemplatesDir),
169154 }
@@ -441,7 +426,7 @@ func (p *OauthProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
441426 if p.Validator(email) {
442427 log.Printf("%s authenticating %s completed", remoteAddr, email)
443428 encoded_token := ""
444− if p.PassAccessToken {
429+ if p.AesCipher != nil {
445430 encoded_token, err = encodeAccessToken(p.AesCipher, access_token)
446431 if err != nil {
447432 log.Printf("error encoding access token: %s", err)