Skip to content

Instantly share code, notes, and snippets.

@ntakouris
Created August 5, 2017 18:51
Show Gist options
  • Save ntakouris/9347892685eaae195c76173b99e0824a to your computer and use it in GitHub Desktop.
Save ntakouris/9347892685eaae195c76173b99e0824a to your computer and use it in GitHub Desktop.
Secure Cookie Init
// Create an authenticated securecookie instance.
if cs.sc == nil {
 cs.sc = securecookie.New(authKey, nil)
 // Use JSON serialization (faster than one-off gob encoding)
 cs.sc.SetSerializer(securecookie.JSONEncoder{})
 // Set the MaxAge of the underlying securecookie.
 cs.sc.MaxAge(cs.opts.MaxAge)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment