SessionCookie
public struct SessionCookie
Defines the properties of an HTTP Cookie which will be used for a TypeSafeSession.
It is valid for multiple TypeSafeSession types to use the same name (i.e. same cookie),
provided they also use the same secret.
Usage Example:
static let sessionCookie = SessionCookie(name: "kitura-session-id", secret: "xyz789", secure: false, maxAge: 300)
-
The name of the cookie - for example, “kitura-session-id”
Declaration
Swift
public let name: String -
Create a new CookieSetup instance which controls how session cookies are created. At minimum, the
nameandsecretfields must be specified.The same
namevalue may be used across multiple TypeSafeSession implementations, resulting in a single session cookie being provided to the client. However in this case the samesecretmust also be used.Usage Example:
static let sessionCookie = SessionCookie(name: "kitura-session-id", secret: "xyz789", secure: false, maxAge: 300)Declaration
Swift
public init(name: String, secret: String, secure: Bool = false, path: String? = nil, domain: String? = nil, maxAge: TimeInterval? = nil)Parameters
nameThe name of the cookie, for example, ‘kitura-session-id’.
secretThe secret data used to encrypt and decrypt session cookies with this name.
secureWhether the cookie should be provided only over secure (https) connections. Defaults to false.
pathThe path for which this cookie should be supplied. Defaults to allow any path.
domainThe domain to which this cookie applies. Defaults to the subdomain of the server issuing the cookie.
maxAgeThe maximum age (in seconds) from the time of issue that the cookie should be kept for. This is a request to the client and may not be honoured.
View on GitHub
SessionCookie Structure Reference