Vapor Documentation Beta

Structure Sessions​Configuration

public struct SessionsConfiguration

Configuration options for sessions.

Initializers

init(cookie​Name:​cookie​Factory:​)

public init(cookieName: String, cookieFactory: @escaping (SessionID) -> HTTPCookies.Value)

Create a new SessionsConfig with the supplied cookie factory.

let sessionsConfig = SessionsConfig(cookieName: "vapor-session") { value in
    return HTTPCookieValue(string: value, isSecure: true)
}

Parameters

cookie​Name String

Name of HTTP cookie, used as a key for the cookie value.

cookie​Factory @escaping (Session​ID) -> HTTPCookies.​Value

Creates a new HTTPCookieValue for the supplied value String.

Properties

cookie​Factory

var cookieFactory: (SessionID) -> HTTPCookies.Value

Creates a new HTTPCookieValue for the supplied value String.

cookie​Name

var cookieName: String

Name of HTTP cookie, used as a key for the cookie value.

Methods

`default`()

public static func `default`() -> SessionsConfiguration

SessionsConfig with basic cookie factory.