Documentation ¶
Index ¶
- Variables
- func CreateChocolatechipCookie(username, email string, role string, buid int64) (string, error)
- func CreateOatmealCookie(username, password, destination, slave string) (string, error)
- func Decrypt(cookie string) (string, error)
- func Encrypt(data string) (string, error)
- func Key() string
- func SetKey(encryptionKey string)
- type Cookie
Constants ¶
This section is empty.
Variables ¶
var ErrUnknownBakeryID = errors.New(`bakery: could not determine bakery user id`)
var ErrUnknownCookieType = errors.New("bakery: unknown cookie type")
var ErrUnknownUserEmail = errors.New(`bakery: could not determine user email`)
var ErrUnknownUserRole = errors.New("bakery: could not determine user role")
var ErrUnknownUsername = errors.New(`bakery: could not determine username`)
Functions ¶
func CreateChocolatechipCookie ¶
CreateChocolatechipCookie generates an HMAC-signed cookie encrypted with AES-128 (ECB mode). Such cookie is to be used with Drupal Bakery SSO module for transferring user credentials. (in gophish app we do not issue CHOCOLATECHIPSSL cookies so this func is used for testing only)
func CreateOatmealCookie ¶
CreateOatmealCookie generates an HMAC-signed cookie encrypted with AES-128 (ECB mode). Such cookie is to be used with Drupal Bakery SSO module for transferring login credentials.
Types ¶
type Cookie ¶
type Cookie struct { Raw string IsOatmeal bool IsChocolateChip bool User string Email string Role string BakeryID int64 Error string }
Cookie contains props of a Bakery SSO cookie
func ParseCookie ¶
ParseCookie decrypts an HMAC-signed cookie encrypted with AES-128 (ECB mode), parses the underlying serialized PHP data structure and returns some props wrapped in Cookie type.