@@ -112,7 +112,7 @@ var (
112
112
_ Validator = Configuration {}
113
113
_ Validator = ProviderConfig {}
114
114
_ Validator = SessionConfig {}
115
- _ Validator = & CookieConfig {}
115
+ _ Validator = CookieConfig {}
116
116
_ Validator = TTLConfig {}
117
117
_ Validator = ClientConfig {}
118
118
_ Validator = ServerConfig {}
@@ -244,16 +244,15 @@ func (sc SessionConfig) Validate() error {
244
244
}
245
245
246
246
type CookieConfig struct {
247
- Name string `mapstructure:"name"`
248
- Secret string `mapstructure:"secret"`
249
- Expire time.Duration `mapstructure:"expire"`
250
- Domain string `mapstructure:"domain"`
251
- Secure bool `mapstructure:"secure"`
252
- HTTPOnly bool `mapstructure:"httponly"`
253
- decodedSecret []byte
247
+ Name string `mapstructure:"name"`
248
+ Secret string `mapstructure:"secret"`
249
+ Expire time.Duration `mapstructure:"expire"`
250
+ Domain string `mapstructure:"domain"`
251
+ Secure bool `mapstructure:"secure"`
252
+ HTTPOnly bool `mapstructure:"httponly"`
254
253
}
255
254
256
- func (cc * CookieConfig ) Validate () error {
255
+ func (cc CookieConfig ) Validate () error {
257
256
if cc .Secret == "" {
258
257
return fmt .Errorf ("no cookie.secret configured" )
259
258
}
@@ -268,9 +267,7 @@ func (cc *CookieConfig) Validate() error {
268
267
validCookieSecretLength = true
269
268
}
270
269
}
271
- if validCookieSecretLength {
272
- cc .decodedSecret = decodedCookieSecret
273
- } else {
270
+ if ! validCookieSecretLength {
274
271
return fmt .Errorf ("invalid value for cookie.secret; must decode to 32 or 64 bytes, but decoded to %d bytes" , len (decodedCookieSecret ))
275
272
}
276
273
0 commit comments