stokito / grails-cookie

Makes dealing with cookies easy. Provides an injectable service and tag to easily get, set, and delete cookies with one line
http://grails.org/plugin/cookie
16 stars 12 forks source link

Make default `path`, `secure` and `httpOnly` configurable and more intelligent #25

Closed stokito closed 9 years ago

stokito commented 9 years ago
// Default expiration age for cookie in seconds. `Max-Age` attribute, integer
// If it has value -1 cookie will not stored and removed after browser close.
// If it has null value or unset, will be used 30 days, i.e. 2592000 seconds
// Can't has value 0, because it means that cookie should be removed
grails.plugins.cookie.cookieage.default = 360 * 24 * 60 * 60

// Default path for cookie selection strategy.
// 'context' - web app context path, i.e. `grails.app.context` option in Config.groovy
// 'root' - root of server, i.e. '/'
// 'current' - current directory, i.e. controller name
// If default path is null or unset, it will be used 'context' strategy
grails.plugins.cookie.path.defaultStrategy = 'context'

// Default secure cookie param. Secure cookie available only for HTTPS connections. `Secure` attribute, boolean.
// If default secure is null or unset, it will set all new cookies as secure if current connection is secure
grails.plugins.cookie.secure.default = null

// Default HTTP only param that denies accessing to JavaScript's `document.cookie`.
// If null or unset
grails.plugins.cookie.httpOnly.default = true