Copyright © 2017-2020 Marc Worrell
Behaviours: zotonic_model.
Authors: Marc Worrell (marc@worrell.nl).
auth_token/2 | Return a token that can be used to logon an user. |
auth_tokens/2 | If authentication was possible, then return auth tokens and cookie url. |
cookie_token/2 | Return a token that can be used to logon an user. |
cookie_url/1 | Url where to exchange the cookie token for a real cookie. |
decode_token/2 | Decode a token, check the hashes. |
m_get/3 | |
m_post/3 | |
send_reminder/2 | Email a reset code to the user. |
set_reminder_secret/2 | Set the unique reminder code for the account. |
site_auth_key/1 | Return the secret site key used for symmetrically encrypting tokens. |
user_auth_key/2 | Fetch the secret user key. |
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(QArgs::map(), Context::z:context()) -> {ok, map()} | {error, term()}
If authentication was possible, then return auth tokens and cookie url.
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(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(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(Rest::list(), Msg::zotonic_model:opt_msg(), Context::z:context()) -> zotonic_model:return()
m_post(Vs::[binary()], Msg::zotonic_model:opt_msg(), Context::z:context()) -> {ok, term()} | {error, term()}
send_reminder(Id, Context) -> any()
Email a reset code to the user.
set_reminder_secret(Id::m_rsc:resource_id(), Context::z:context()) -> binary()
Set the unique reminder code for the account.
site_auth_key(Context::z:context()) -> binary()
Return the secret site key used for symmetrically encrypting tokens.
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