Module z_auth

Handle authentication of zotonic users.

Copyright © 2009-2021 Marc Worrell Date: 2009-04-24

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

Description

Handle authentication of zotonic users. Also shows the logon screen when authentication is required.

Function Index

confirm/2Set the user to 'confirmed'.
is_auth/1Check if the visitor has been authenticated.
is_enabled/2Check if the user is enabled, an user is enabled when the rsc is published and within its publication date range.
logoff/1Forget about the user being logged on.
logon/2Logon an user whose id we know, set all user prefs in the context.
logon_pw/3Logon a username/password combination, checks passwords with m_identity.
logon_redirect/3Logon an user and redirect the user agent.
logon_switch/2Allow an admin user to switch to another user account.
logon_switch/3Allow an admin user to switch to another user account.
switch_user/2Request the client's auth worker to re-authenticate as a new user.

Function Details

confirm/2

confirm(UserId::m_rsc:resource_id(), Context::z:context()) -> {ok, z:context()} | {error, user_not_enabled}

Set the user to 'confirmed'.

is_auth/1

is_auth(Context::z:context()) -> boolean()

Check if the visitor has been authenticated. Assumes a completely initalized context.

is_enabled/2

is_enabled(UserId::m_rsc:resource_id(), Context::z:context()) -> boolean()

Check if the user is enabled, an user is enabled when the rsc is published and within its publication date range.

logoff/1

logoff(Context::z:context()) -> z:context()

Forget about the user being logged on.

logon/2

logon(UserId::m_rsc:resource_id(), Context::z:context()) -> {ok, z:context()} | {error, user_not_enabled}

Logon an user whose id we know, set all user prefs in the context.

logon_pw/3

logon_pw(Username::binary(), Password::binary(), Context::z:context()) -> {boolean(), z:context()}

Logon a username/password combination, checks passwords with m_identity.

logon_redirect/3

logon_redirect(UserId::m_rsc:resource_id(), Url::binary() | undefined, Context::z:context()) -> ok | {error, term()}

Logon an user and redirect the user agent. The MQTT websocket MUST be connected.

logon_switch/2

logon_switch(UserId::m_rsc:resource_id(), Context::z:context()) -> {ok, z:context()} | {error, eacces}

Allow an admin user to switch to another user account.

logon_switch/3

logon_switch(UserId::m_rsc:resource_id(), SudoUserId::m_rsc:resource_id(), Context::z:context()) -> {ok, z:context()} | {error, eacces}

Allow an admin user to switch to another user account.

switch_user/2

switch_user(UserId::m_rsc:resource_id(), Context::z:context()) -> ok | {error, eacces}

Request the client's auth worker to re-authenticate as a new user


Generated by EDoc