Module m_authentication

Model for mod_authentication.

Copyright © 2017-2020 Marc Worrell

Behaviours: zotonic_model.

Authors: Marc Worrell (marc@worrell.nl).

Description

Model for mod_authentication

Function Index

auth_token/2Return a token that can be used to logon an user.
auth_tokens/2If authentication was possible, then return auth tokens and cookie url.
cookie_token/2Return a token that can be used to logon an user.
cookie_url/1Url where to exchange the cookie token for a real cookie.
decode_token/2Decode a token, check the hashes.
m_get/3
m_post/3
send_reminder/2Email a reset code to the user.
set_reminder_secret/2Set the unique reminder code for the account.
site_auth_key/1Return the secret site key used for symmetrically encrypting tokens.
user_auth_key/2Fetch the secret user key.

Function Details

auth_token/2

auth_token(UserId, Context) -> any()

Return a token that can be used to logon an user. The token is only valid for a short period and can be used for a MQTT authentication.

auth_tokens/2

auth_tokens(QArgs::map(), Context::z:context()) -> {ok, map()} | {error, term()}

If authentication was possible, then return auth tokens and cookie url.

cookie_token/2

cookie_token(UserId, Context) -> any()

Return a token that can be used to logon an user. The token is only valid for a short period and can be used for a MQTT authentication.

cookie_url/1

cookie_url(Context) -> any()

Url where to exchange the cookie token for a real cookie. Handled by a special controller. The token must be posted to the url as-is.

decode_token/2

decode_token(Token::binary(), Context::z:context()) -> {ok, {cookie | auth, UserId::m_rsc:rid(), Timestamp::pos_integer()}} | {error, illegal}

Decode a token, check the hashes.

m_get/3

m_get(Rest::list(), Msg::zotonic_model:opt_msg(), Context::z:context()) -> zotonic_model:return()

m_post/3

m_post(Vs::[binary()], Msg::zotonic_model:opt_msg(), Context::z:context()) -> {ok, term()} | {error, term()}

send_reminder/2

send_reminder(Id, Context) -> any()

Email a reset code to the user.

set_reminder_secret/2

set_reminder_secret(Id::m_rsc:resource_id(), Context::z:context()) -> binary()

Set the unique reminder code for the account.

site_auth_key/1

site_auth_key(Context::z:context()) -> binary()

Return the secret site key used for symmetrically encrypting tokens.

user_auth_key/2

user_auth_key(UserId::m_rsc:rid(), Context::z:context()) -> binary()

Fetch the secret user key. This key is used to add an extra hash of the tokens.


Generated by EDoc