Documentation ¶
Index ¶
- Constants
- func ApplySession(dec CookieCoder, req *http.Request) *http.Request
- func DecodeCookie(cc CookieCoder, ck *http.Cookie, ignoreValidity bool) (string, error)
- func DecodeString(cc CookieCoder, s string) (string, error)
- func DecryptCookie(cc CookieCoder, ck *http.Cookie, ignoreValidity bool) (string, error)
- func DecryptString(cc CookieCoder, s string) (string, error)
- func EncodeString(cc CookieCoder, s string) string
- func EncryptString(cc CookieCoder, s string) (string, error)
- func WithSession(handler http.Handler, dec CookieCoder) http.Handler
- type Configuration
- type CookieCoder
- type Session
Constants ¶
View Source
const ( DefaultSignedCookieSalt = "signed cookie" DefaultEncryptedCookieSalt = "encrypted cookie" DefaultEncryptedSignedCookieSalt = "signed encrypted cookie" SessionContextKey = "rails_session" )
Variables ¶
This section is empty.
Functions ¶
func ApplySession ¶
func ApplySession(dec CookieCoder, req *http.Request) *http.Request
func DecodeCookie ¶
func DecodeString ¶
func DecodeString(cc CookieCoder, s string) (string, error)
func DecryptCookie ¶
func DecryptString ¶
func DecryptString(cc CookieCoder, s string) (string, error)
func EncodeString ¶
func EncodeString(cc CookieCoder, s string) string
func EncryptString ¶
func EncryptString(cc CookieCoder, s string) (string, error)
func WithSession ¶
func WithSession(handler http.Handler, dec CookieCoder) http.Handler
Types ¶
type Configuration ¶
type Configuration struct { SecretKeyBase string SignedCookieSalt string EncryptedSignedCookieSalt string EncryptedCookieSalt string RNG io.Reader }
func DefaultConfiguration ¶
func DefaultConfiguration() Configuration
type CookieCoder ¶
type CookieCoder interface { Decode(s string) ([]byte, error) Encode(data []byte) string Decrypt(s string) ([]byte, error) Encrypt(data []byte) (string, error) }
func NewRails5CookieCoder ¶
func NewRails5CookieCoder(cfg Configuration) (CookieCoder, error)
type Session ¶
type Session struct { SessionID string `json:"session_id"` CSRFToken string `json:"_csrf_token"` LastBGSet int64 `json:"last_bg_set"` BG int64 `json:"bg"` }
func DecryptSessionCookie ¶
func RetrieveSession ¶
Click to show internal directories.
Click to hide internal directories.