Created
August 5, 2017 18:48
-
-
Save ntakouris/1a6606a84f1ea0563482c3eab294d105 to your computer and use it in GitHub Desktop.
store.go fragment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// store represents the session storage used for CSRF tokens. | |
type store interface { | |
// Get returns the real CSRF token from the store. | |
Get(*http.Request) ([]byte, error) | |
// Save stores the real CSRF token in the store and writes a | |
// cookie to the http.ResponseWriter. | |
// For non-cookie stores, the cookie should contain a unique (256 bit) ID | |
// or key that references the token in the backend store. | |
// csrf.GenerateRandomBytes is a helper function for generating secure IDs. | |
Save(token []byte, w http.ResponseWriter) error | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment