Module mochiweb_session

HTTP Cookie session.

Copyright © 2013 Mochi Media, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Authors: Asier Azkuenaga Batiz (asier@zebixe.com).

Description

HTTP Cookie session. Note that the expiration time travels unencrypted as far as this module is concerned. In order to achieve more security, it is advised to use https. Based on the paper "A Secure Cookie Protocol". This module is only supported on R15B02 and later, the AES CFB mode is not available in earlier releases of crypto.

Data Types

expiration_time()

expiration_time() = integer()

header()

header() = {string(), string()}

key_fun()

key_fun() = fun((string()) -> iolist())

Function Index

check_session_cookie/4
generate_session_cookie/4Convenience wrapper for generate_session_data that returns a mochiweb cookie with "id" as the key, a max_age of 20000 seconds, and the current local time as local time.
generate_session_data/4Generates a secure encrypted binary convining all the parameters.

Function Details

check_session_cookie/4

check_session_cookie(ECookie::binary(), ExpirationTime::string(), FSessionKey::key_fun(), ServerKey::iolist()) -> {Success::boolean(), ExpTimeAndData::[integer() | binary()]}

generate_session_cookie/4

generate_session_cookie(ExpirationTime::expiration_time(), Data::iolist(), FSessionKey::key_fun(), ServerKey::iolist()) -> header()

Convenience wrapper for generate_session_data that returns a mochiweb cookie with "id" as the key, a max_age of 20000 seconds, and the current local time as local time.

generate_session_data/4

generate_session_data(ExpirationTime::expiration_time(), Data::iolist(), FSessionKey::key_fun(), ServerKey::iolist()) -> binary()

Generates a secure encrypted binary convining all the parameters. The expiration time must be a 32-bit integer.


Generated by EDoc