-
Notifications
You must be signed in to change notification settings - Fork 0
/
amelinium.common.controller.html
30 lines (30 loc) · 33.5 KB
/
amelinium.common.controller.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>amelinium.common.controller documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="stylesheet" type="text/css" href="css/randomseed.css" /></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Amelinium</span> <span class="project-version">1.0.1</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="10_introduction.html"><div class="inner"><span>Introduction</span></div></a></li><li class="depth-1 "><a href="20_hypermedia.html"><div class="inner"><span>Hypermedia-driven</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><a href="amelinium.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>amelinium</span></div></a></li><li class="depth-2 branch"><a href="amelinium.admin.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>admin</span></div></a></li><li class="depth-2"><a href="amelinium.api.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>api</span></div></a></li><li class="depth-3"><a href="amelinium.api.controller.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>controller</span></div></a></li><li class="depth-4"><a href="amelinium.api.controller.user.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>user</span></div></a></li><li class="depth-3"><a href="amelinium.api.url.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>url</span></div></a></li><li class="depth-2 branch"><a href="amelinium.app.html"><div class="inner"><span class="tree" style="top: -114px;"><span class="top" style="height: 123px;"></span><span class="bottom"></span></span><span>app</span></div></a></li><li class="depth-2"><a href="amelinium.auth.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>auth</span></div></a></li><li class="depth-3"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>algo</span></div></div></li><li class="depth-4 branch"><a href="amelinium.auth.algo.append.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>append</span></div></a></li><li class="depth-4 branch"><a href="amelinium.auth.algo.fail.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>fail</span></div></a></li><li class="depth-4 branch"><a href="amelinium.auth.algo.pbkdf2.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>pbkdf2</span></div></a></li><li class="depth-4"><a href="amelinium.auth.algo.scrypt.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>scrypt</span></div></a></li><li class="depth-3 branch"><a href="amelinium.auth.pwd.html"><div class="inner"><span class="tree" style="top: -145px;"><span class="top" style="height: 154px;"></span><span class="bottom"></span></span><span>pwd</span></div></a></li><li class="depth-3"><a href="amelinium.auth.specs.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>specs</span></div></a></li><li class="depth-2"><a href="amelinium.common.html"><div class="inner"><span class="tree" style="top: -238px;"><span class="top" style="height: 247px;"></span><span class="bottom"></span></span><span>common</span></div></a></li><li class="depth-3 branch current"><a href="amelinium.common.controller.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>controller</span></div></a></li><li class="depth-3"><a href="amelinium.common.oplog.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>oplog</span></div></a></li><li class="depth-4"><a href="amelinium.common.oplog.auth.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>auth</span></div></a></li><li class="depth-3 branch"><a href="amelinium.common.populators.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>populators</span></div></a></li><li class="depth-3"><a href="amelinium.common.swagger.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>swagger</span></div></a></li><li class="depth-2 branch"><a href="amelinium.core.html"><div class="inner"><span class="tree" style="top: -176px;"><span class="top" style="height: 185px;"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2"><a href="amelinium.db.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>db</span></div></a></li><li class="depth-3"><a href="amelinium.db.sql.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>sql</span></div></a></li><li class="depth-2 branch"><a href="amelinium.errors.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>errors</span></div></a></li><li class="depth-2"><a href="amelinium.http.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>http</span></div></a></li><li class="depth-3"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>client</span></div></div></li><li class="depth-4"><a href="amelinium.http.client.twilio.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>twilio</span></div></a></li><li class="depth-3 branch"><a href="amelinium.http.handler.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>handler</span></div></a></li><li class="depth-3"><a href="amelinium.http.middleware.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>middleware</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.coercion.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>coercion</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.content.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>content</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.db.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>db</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.debug.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>debug</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.format.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>format</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.headers.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>headers</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.language.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>language</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.lazy-req.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>lazy-req</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.populators.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>populators</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.remote-ip.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>remote-ip</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.roles.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>roles</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.session.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>session</span></div></a></li><li class="depth-4"><a href="amelinium.http.middleware.validators.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>validators</span></div></a></li><li class="depth-3 branch"><a href="amelinium.http.router.html"><div class="inner"><span class="tree" style="top: -424px;"><span class="top" style="height: 433px;"></span><span class="bottom"></span></span><span>router</span></div></a></li><li class="depth-3"><a href="amelinium.http.server.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>server</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.server.jetty.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>jetty</span></div></a></li><li class="depth-4"><a href="amelinium.http.server.undertow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>undertow</span></div></a></li><li class="depth-2"><a href="amelinium.i18n.html"><div class="inner"><span class="tree" style="top: -672px;"><span class="top" style="height: 681px;"></span><span class="bottom"></span></span><span>i18n</span></div></a></li><li class="depth-3"><a href="amelinium.i18n.pluralizers.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>pluralizers</span></div></a></li><li class="depth-2 branch"><a href="amelinium.identity.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>identity</span></div></a></li><li class="depth-2 branch"><a href="amelinium.locale.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>locale</span></div></a></li><li class="depth-2 branch"><a href="amelinium.logging.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>logging</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>model</span></div></div></li><li class="depth-3 branch"><a href="amelinium.model.confirmation.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>confirmation</span></div></a></li><li class="depth-3"><a href="amelinium.model.user.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>user</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>proto</span></div></div></li><li class="depth-3 branch"><a href="amelinium.proto.auth.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>auth</span></div></a></li><li class="depth-3 branch"><a href="amelinium.proto.errors.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>errors</span></div></a></li><li class="depth-3 branch"><a href="amelinium.proto.identity.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>identity</span></div></a></li><li class="depth-3 branch"><a href="amelinium.proto.session.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>session</span></div></a></li><li class="depth-3"><a href="amelinium.proto.twilio.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>twilio</span></div></a></li><li class="depth-2 branch"><a href="amelinium.schemas.html"><div class="inner"><span class="tree" style="top: -176px;"><span class="top" style="height: 185px;"></span><span class="bottom"></span></span><span>schemas</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>server</span></div></div></li><li class="depth-3"><a href="amelinium.server.ssl.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>ssl</span></div></a></li><li class="depth-2 branch"><a href="amelinium.system.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>system</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>types</span></div></div></li><li class="depth-3 branch"><a href="amelinium.types.auth.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>auth</span></div></a></li><li class="depth-3 branch"><a href="amelinium.types.db.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>db</span></div></a></li><li class="depth-3 branch"><a href="amelinium.types.errors.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>errors</span></div></a></li><li class="depth-3 branch"><a href="amelinium.types.identity.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>identity</span></div></a></li><li class="depth-3 branch"><a href="amelinium.types.session.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>session</span></div></a></li><li class="depth-3"><a href="amelinium.types.twilio.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>twilio</span></div></a></li><li class="depth-2 branch"><a href="amelinium.utils.html"><div class="inner"><span class="tree" style="top: -207px;"><span class="top" style="height: 216px;"></span><span class="bottom"></span></span><span>utils</span></div></a></li><li class="depth-2"><a href="amelinium.web.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>web</span></div></a></li><li class="depth-3"><a href="amelinium.web.controller.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>controller</span></div></a></li><li class="depth-4 branch"><a href="amelinium.web.controller.admin.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>admin</span></div></a></li><li class="depth-4"><a href="amelinium.web.controller.user.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>user</span></div></a></li><li class="depth-3 branch"><a href="amelinium.web.js.html"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>js</span></div></a></li><li class="depth-3 branch"><a href="amelinium.web.taggers.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>taggers</span></div></a></li><li class="depth-3"><a href="amelinium.web.url.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>url</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="amelinium.common.controller.html#var-account-locked.3F"><div class="inner"><span>account-locked?</span></div></a></li><li class="depth-1"><a href="amelinium.common.controller.html#var-auth-user-with-password.21"><div class="inner"><span>auth-user-with-password!</span></div></a></li><li class="depth-1"><a href="amelinium.common.controller.html#var-authenticate.21"><div class="inner"><span>authenticate!</span></div></a></li><li class="depth-1"><a href="amelinium.common.controller.html#var-check-password"><div class="inner"><span>check-password</span></div></a></li><li class="depth-1"><a href="amelinium.common.controller.html#var-get-goto"><div class="inner"><span>get-goto</span></div></a></li><li class="depth-1"><a href="amelinium.common.controller.html#var-get-goto-for-valid"><div class="inner"><span>get-goto-for-valid</span></div></a></li><li class="depth-1"><a href="amelinium.common.controller.html#var-get-goto-uri"><div class="inner"><span>get-goto-uri</span></div></a></li><li class="depth-1"><a href="amelinium.common.controller.html#var-handle-coercion-error"><div class="inner"><span>handle-coercion-error</span></div></a></li><li class="depth-1"><a href="amelinium.common.controller.html#var-hard-expiry.3F"><div class="inner"><span>hard-expiry?</span></div></a></li><li class="depth-1"><a href="amelinium.common.controller.html#var-hx-prolong.3F"><div class="inner"><span>hx-prolong?</span></div></a></li><li class="depth-1"><a href="amelinium.common.controller.html#var-invalidate-user-sessions.21"><div class="inner"><span>invalidate-user-sessions!</span></div></a></li><li class="depth-1"><a href="amelinium.common.controller.html#var-keywordize-params.3F"><div class="inner"><span>keywordize-params?</span></div></a></li><li class="depth-1"><a href="amelinium.common.controller.html#var-kw-form-data"><div class="inner"><span>kw-form-data</span></div></a></li><li class="depth-1"><a href="amelinium.common.controller.html#var-lock-remaining-mins"><div class="inner"><span>lock-remaining-mins</span></div></a></li><li class="depth-1"><a href="amelinium.common.controller.html#var-prolongation-auth.3F"><div class="inner"><span>prolongation-auth?</span></div></a></li><li class="depth-1"><a href="amelinium.common.controller.html#var-prolongation.3F"><div class="inner"><span>prolongation?</span></div></a></li><li class="depth-1"><a href="amelinium.common.controller.html#var-regular-auth.3F"><div class="inner"><span>regular-auth?</span></div></a></li><li class="depth-1"><a href="amelinium.common.controller.html#var-set-password.21"><div class="inner"><span>set-password!</span></div></a></li><li class="depth-1"><a href="amelinium.common.controller.html#var-throw-bad-param"><div class="inner"><span>throw-bad-param</span></div></a></li><li class="depth-1"><a href="amelinium.common.controller.html#var-verify-process-error"><div class="inner"><span>verify-process-error</span></div></a></li><li class="depth-1"><a href="amelinium.common.controller.html#var-verify-request-id-update"><div class="inner"><span>verify-request-id-update</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">amelinium.common.controller</h1><h4 class="added">added in 1.0.0</h4><div class="doc"><div class="markdown"><p>amelinium service, common controller functions.</p>
</div></div><div class="public anchor" id="var-account-locked.3F"><h3>account-locked?</h3><div class="usage"><code>(account-locked? req session)</code><code>(account-locked? req session db)</code></div><div class="doc"><div class="markdown"><p>Returns true if an account associated with the session is hard-locked. Uses cached property.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/common/controller.clj#L58">view source</a></div></div><div class="public anchor" id="var-auth-user-with-password.21"><h3>auth-user-with-password!</h3><div class="usage"><code>(auth-user-with-password! req user-email password)</code><code>(auth-user-with-password! req user-email password sess)</code><code>(auth-user-with-password! req user-email password sess route-data)</code><code>(auth-user-with-password! req user-email password sess route-data auth-only-mode)</code><code>(auth-user-with-password! req user-email password sess route-data auth-only-mode session-key)</code></div><div class="doc"><div class="markdown"><p>Authentication helper. Used by other controllers. Short-circuits on certain conditions and may emit a redirect (if a go-to was detected) or set the <code>:response/status</code> in the returned request map (but not in the response map!).</p>
<p>In case of successful authentication it will set <code>:auth/ok</code> to <code>true</code> and <code>:response-status</code> to <code>:auth/ok</code>.</p>
<p>In case of session prolongation and successful authentication it will set <code>:auth/ok?</code> to <code>true</code> and <code>:response/status</code> to <code>:auth/prolonged-ok</code>.</p>
<p>The last, <code>auth-only-mode</code> argument, when set to <code>true</code> (default is <code>false</code> when not given) causes session creation and prolongation to be skipped if the authentication is successful.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/common/controller.clj#L205">view source</a></div></div><div class="public anchor" id="var-authenticate.21"><h3>authenticate!</h3><div class="usage"><code>(authenticate! req user-email user-password)</code><code>(authenticate! req user-email user-password session-key)</code></div><div class="doc"><div class="markdown"><p>Logs user in when user e-mail and password are given, or checks if the session is valid to serve a current page.</p>
<p>Takes a request map and obtains database connection, client IP address and authentication configuration from it. Also <code>login</code> and <code>password</code> strings. Calls <code>auth-user-with-password!</code> to get a result or a redirect if authentication was not successful.</p>
<p>If there is no e-mail or password given (the value is <code>nil</code>, <code>false</code> or an empty string) then authentication is not performed but instead validity of a session is tested. If the session is invalid, the redirect to a login page is performed. The destination URL is obtained via a route name taken from the <code>:auth/info</code> key of a route data, or from <code>:login</code> route identifier (as default). If the session is valid then the given request map is returned as-is.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/common/controller.clj#L324">view source</a></div></div><div class="public anchor" id="var-check-password"><h3>check-password</h3><div class="usage"><code>(check-password user password auth-config)</code></div><div class="doc"><div class="markdown"><p>Check password using authentication configuration.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/common/controller.clj#L49">view source</a></div></div><div class="public anchor" id="var-get-goto"><h3>get-goto</h3><div class="usage"><code>(get-goto smap)</code></div><div class="doc"><div class="markdown"><p>Gets go-to map from a session variable even if the session is not valid.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/common/controller.clj#L137">view source</a></div></div><div class="public anchor" id="var-get-goto-for-valid"><h3>get-goto-for-valid</h3><div class="usage"><code>(get-goto-for-valid smap)</code></div><div class="doc"><div class="markdown"><p>Gets go-to map from session variable if the session is valid (and not expired).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/common/controller.clj#L142">view source</a></div></div><div class="public anchor" id="var-get-goto-uri"><h3>get-goto-uri</h3><div class="usage"><code>(get-goto-uri req sess)</code></div><div class="doc"><div class="markdown"><p>Obtains go-to URI from <code>req</code> if <code>am/goto</code> form parameter is present and session is soft-expired. Used to get the destination URI from a session variable when user is authenticated to be redirected into a page where session expiration has been encountered a moment ago.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/common/controller.clj#L124">view source</a></div></div><div class="public anchor" id="var-handle-coercion-error"><h3>handle-coercion-error</h3><div class="usage"><code>(handle-coercion-error e respond raise)</code></div><div class="doc"><div class="markdown"><p>Generic coercion error handler. Takes an exception object <code>e</code> and two functions: <code>respond</code> which will receive the response and should pre-process it (defaults to <code>clojure.core/identity</code> if falsy), <code>raise</code> which should handle the exception if its type is unusual and (possibly) re-throw it (defaults to <code>throw</code>).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/common/controller.clj#L389">view source</a></div></div><div class="public anchor" id="var-hard-expiry.3F"><h3>hard-expiry?</h3><div class="usage"><code>(hard-expiry? req sess route-data)</code></div><div class="doc"><div class="markdown"><p>Returns <code>true</code> if the session is hard-expired and we are not on the hard-expired login page. Uses the given, previously collected session data. Does not connect to a database.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/common/controller.clj#L113">view source</a></div></div><div class="public anchor" id="var-hx-prolong.3F"><h3>hx-prolong?</h3><div class="usage"><code>(hx-prolong? req route-data sess)</code></div><div class="doc"><div class="markdown"><p>Returns <code>true</code> if authentication is about prolonging session with HTMX request.</p>
<p>Requires session <code>sess</code> to be soft-expired and <code>HX-Target</code> request header taken from <code>req</code> (under <code>:headers</code> key) to indicate the same target as configured <code>:auth/prolongate</code> target value for <code>:status/targets</code> map of a route data (given as <code>route-data</code>).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/common/controller.clj#L165">view source</a></div></div><div class="public anchor" id="var-invalidate-user-sessions.21"><h3>invalidate-user-sessions!</h3><div class="usage"><code>(invalidate-user-sessions! req route-data id-type id user-id)</code><code>(invalidate-user-sessions! req route-data id-type id user-id session-key)</code></div><div class="doc"><div class="markdown"><p>Invalidates user sessions if <code>id-type</code> is an e-mail.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/common/controller.clj#L195">view source</a></div></div><div class="public anchor" id="var-keywordize-params.3F"><h3>keywordize-params?</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/common/controller.clj#L31">view source</a></div></div><div class="public anchor" id="var-kw-form-data"><h3>kw-form-data</h3><div class="usage"><code>(kw-form-data form-data)</code><code>(kw-form-data form-data opts)</code></div><div class="doc"><div class="markdown"><p>Changes form data keys into keywords by calling <code>ring.middleware.keyword-params/keyword-params-request</code> on a specially crafted map.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/common/controller.clj#L36">view source</a></div></div><div class="public anchor" id="var-lock-remaining-mins"><h3>lock-remaining-mins</h3><div class="usage"><code>(lock-remaining-mins req auth-db smap time-fn)</code><code>(lock-remaining-mins req auth-db smap time-fn id-field)</code></div><div class="doc"><div class="markdown"><p>Returns the time of the remaining minutes of a soft account lock when the visited page ID is <code>:login/account-soft-locked</code>. Otherwise it returns <code>nil</code>. Uses cached user properties.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/common/controller.clj#L67">view source</a></div></div><div class="public anchor" id="var-prolongation-auth.3F"><h3>prolongation-auth?</h3><div class="usage"><code>(prolongation-auth? sess login? auth? login-data?)</code></div><div class="doc"><div class="markdown"><p>Returns <code>true</code> if user visited the prolongation page after submitting credentials to the authentication page is being authenticated to prolongate the soft-expired session.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/common/controller.clj#L93">view source</a></div></div><div class="public anchor" id="var-prolongation.3F"><h3>prolongation?</h3><div class="usage"><code>(prolongation? sess [login? auth?] login-data?)</code></div><div class="doc"><div class="markdown"><p>Returns <code>true</code> if the given session <code>sess</code> is expired (but not hard expired), current user is not logged in, there is no login data present, and we are not authenticating any user. In other words: returns <code>true</code> when we are good with redirecting a user to a session prolongation page (a form of login page).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/common/controller.clj#L82">view source</a></div></div><div class="public anchor" id="var-regular-auth.3F"><h3>regular-auth?</h3><div class="usage"><code>(regular-auth? sess login? auth? login-data?)</code></div><div class="doc"><div class="markdown"><p>Returns <code>true</code> if user is being authenticated.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/common/controller.clj#L104">view source</a></div></div><div class="public anchor" id="var-set-password.21"><h3>set-password!</h3><div class="usage"><code>(set-password! req user-id password)</code></div><div class="doc"><div class="markdown"><p>Sets user password for the given user ID. Returns <code>:pwd/created</code> if operation succeeded. May return error statuses: <code>:pwd/bad-user</code>, <code>:pwd/db-error</code>, <code>:pwd/bad-password</code>. User must have account type assigned for this operation to succeed.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/common/controller.clj#L361">view source</a></div></div><div class="public anchor" id="var-throw-bad-param"><h3>throw-bad-param</h3><div class="usage"><code>(throw-bad-param req param value param-type)</code></div><div class="doc"><div class="markdown"><p>Generates bad parameter exception which should trigger coercion error. The value of <code>param-type</code> must be a valid schema.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/common/controller.clj#L408">view source</a></div></div><div class="public anchor" id="var-verify-process-error"><h3>verify-process-error</h3><div class="usage"><code>(verify-process-error db id-type id code token exception)</code></div><div class="doc"><div class="markdown"><p>Default error processor for asynchronous e-mail or SMS sending.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/common/controller.clj#L190">view source</a></div></div><div class="public anchor" id="var-verify-request-id-update"><h3>verify-request-id-update</h3><div class="usage"><code>(verify-request-id-update db id-type id code token response)</code></div><div class="doc"><div class="markdown"><p>Default confirmation request ID field updater for asynchronous identity confirmation.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/common/controller.clj#L180">view source</a></div></div></div></body></html>