Classvapor 4.106.3Vapor
Session
Sessions are a method for associating data with a client accessing your app.
Session.swift:9final class Session
Each session has a unique identifier that is used to look it up with each request to your app. This is usually done via HTTP cookies.
See Request.session()
and SessionsMiddleware
for more information.
Citizens in Vapor
Conformances
Type members
init(id: SessionID?, data: SessionData
) Create a new
Session
.
Instance members
var data: SessionData
This session’s data.
var id: SessionID?
This session’s unique identifier. Usually a cookie value.
func authenticate<A>(A
) Authenticates the model into the session.
func authenticated<A>(A.Type
) -> A.SessionID? Returns the authenticatable type’s ID if it exists in the session data.
func destroy(
) Invalidates the current session, removing persisted data from the session driver and invalidating the cookie.
func unauthenticate<A>(A.Type
) Un-authenticates the model from the session.