Dancer2::Session::Cookie(3pm)

Dancer2::Session::Cookie3pm

Dancer 2 session storage in secure cookies

Usage

  # In Dancer 2 config.yml file
  session: Cookie
  engines:
    session:
      Cookie:
        secret_key:           your secret passphrase
        default_duration:     604800
        with_request_address: 0

Version

version 0.009

Overview

This module implements a session factory for Dancer 2 that stores session state within a browser cookie. Features include:

•

Data serialization and compression using Sereal

•

Data encryption using AES with a unique derived key per cookie

•

Enforced expiration timestamp (independent of cookie expiration)

•

Cookie integrity protected with a message authentication code (MAC)

See Session::Storage::Secure for implementation details and important security caveats.

Attributes

secret_key (required)

This is used to secure the cookies. Encryption keys and message authentication keys are derived from this using one-way functions. Changing it will invalidate all sessions.

default_duration

Number of seconds for which the session may be considered valid. If "cookie_duration" is not set as part of the session configuration, this is used instead to expire the session after a period of time, regardless of the length of the browser session. It is unset by default, meaning that sessions expiration is not capped.

with_request_address

If set to "true", the secret key will have the request address (as provided by "<$request-"address>>) appended to it. This can help defeat some replay attacks (e.g. if the channel is not secure). But it will also cause session interruption for people on dynamic addresses.

Author

David Golden <[email protected]>

From libdancer2-session-cookie-perl 0.009-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.