Plug.Session
A plug to handle session cookies and session stores.
The session is accessed via functions on Plug.Conn
. Cookies and
session have to be fetched with Plug.Conn.fetch_session/1
before the
session can be accessed.
Session stores
See Plug.Session.Store
for the specification session stores are required to
implement.
Plug ships with the following session stores:
Options
:store
- session store module (required);:key
- session cookie key (required);:domain
- seePlug.Conn.put_resp_cookies/4
;:max_age
- seePlug.Conn.put_resp_cookies/4
;:path
- seePlug.Conn.put_resp_cookies/4
;:secure
- seePlug.Conn.put_resp_cookies/4
;
Additional options can be given to the session store, see the store’s documentation for the options it accepts.
Examples
plug Plug.Session, store: :ets, key: "_my_app_session", secure: true, table: :session
Summary
call(conn, config) | Callback implementation of |
init(opts) | Callback implementation of |