CookieParameter

public enum CookieParameter

The parameters for configuring the cookies used to send the session IDs to the clients.

Usage Example:

let session = Session(secret: "Something very secret", cookie: [.name("mySessionId")])
router.all(middleware: session)

In the example, an instance of Session is created with a custom value for the CookieParameter name.

  • The cookie’s name. Defaults to “kitura-session-id”.

    Declaration

    Swift

    case name(String)
  • The cookie’s path attribute. This specifies the path for which the cookie is valid. The client should only provide this cookie for requests on this path.

    Declaration

    Swift

    case path(String)
  • The cookie’s secure attribute, indicating whether the cookie should be provided only over secure (https) connections. Defaults to false.

    Declaration

    Swift

    case secure(Bool)
  • The cookie’s maxAge attribute, that is, the maximum age (in seconds) from the time of issue that the cookie should be kept for. Defaults to -1.0, i.e. no expiration.

    Declaration

    Swift

    case maxAge(TimeInterval)