poa-netstats-warehouse/doc/POABackend.Auth.html

893 lines
28 KiB
HTML
Raw Normal View History

2018-08-10 14:58:29 -07:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="ExDoc v0.18.4">
<title>POABackend.Auth poa_backend v0.1.0</title>
<link rel="stylesheet" href="dist/app-480ffdc169.css" />
2018-09-05 05:08:57 -07:00
<script src="dist/sidebar_items-f62ce50de1.js"></script>
2018-08-10 14:58:29 -07:00
</head>
<body data-type="modules">
<script>try { if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; } catch (e) { }</script>
<div class="main">
<button class="sidebar-button sidebar-toggle">
<span class="icon-menu" aria-hidden="true"></span>
<span class="sr-only">Toggle Sidebar</span>
</button>
<button class="sidebar-button night-mode-toggle">
<span class="icon-theme" aria-hidden="true"></span>
<span class="sr-only">Toggle Theme</span>
</button>
<section class="sidebar">
<a href="POABackend.html" class="sidebar-projectLink">
<div class="sidebar-projectDetails">
<h1 class="sidebar-projectName">
poa_backend
</h1>
<h2 class="sidebar-projectVersion">
v0.1.0
</h2>
</div>
</a>
<form class="sidebar-search" action="search.html">
<button type="submit" class="search-button">
<span class="icon-search" aria-hidden="true"></span>
</button>
<input name="q" type="text" id="search-list" class="search-input" placeholder="Search" aria-label="Search" autocomplete="off" />
</form>
<ul class="sidebar-listNav">
<li><a id="extras-list" href="#full-list">Pages</a></li>
<li><a id="modules-list" href="#full-list">Modules</a></li>
</ul>
<div class="gradient"></div>
<ul id="full-list" class="sidebar-fullList"></ul>
</section>
<section class="content">
<div class="content-outer">
<div id="content" class="content-inner">
<h1>
<small class="visible-xs">poa_backend v0.1.0</small>
POABackend.Auth
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/auth.ex#L1" title="View Source" class="view-source" rel="help">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
</h1>
<section id="moduledoc">
<p>This module defines the API for the Authorisation</p>
</section>
<section id="summary" class="details-list">
<h1 class="section-heading">
<a class="hover-link" href="#summary">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this section</span>
</a>
Summary
</h1>
<div class="summary-functions summary">
<h2>
<a href="#functions">Functions</a>
</h2>
<div class="summary-row">
<div class="summary-signature">
<a href="#activate_user/1">activate_user(user)</a>
</div>
<div class="summary-synopsis"><p>This function Activates a user, storing <code class="inline">active: true</code> in the database for the given user</p>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#authenticate_admin/2">authenticate_admin(admin_name, password)</a>
</div>
<div class="summary-synopsis"><p>Authenticates an Admin</p>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#authenticate_user/2">authenticate_user(user_name, password)</a>
</div>
<div class="summary-synopsis"><p>This function authenticates a user/password pair</p>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#create_banned_token/1">create_banned_token(jwt_token)</a>
</div>
<div class="summary-synopsis"><p>Creates a token entry in the banned tokens table. It receives a jwt token in String format.
This function will extract the expiration time from the claims and store them in the Database</p>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#create_banned_token/2">create_banned_token(token, expires)</a>
</div>
<div class="summary-synopsis"><p>Creates a token entry in the banned tokens table. It receives the token in String format and the
expiration time as Integer</p>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#create_user/3">create_user(user_name, password, active \\ true)</a>
</div>
<div class="summary-synopsis"><p>Registers a user in the system</p>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#deactivate_user/1">deactivate_user(user)</a>
</div>
<div class="summary-synopsis"><p>This function Deactivates a user, storing <code class="inline">active: false</code> in the database for the given user</p>
</div>
2018-09-05 05:08:57 -07:00
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#delete_user/1">delete_user(user_name)</a>
</div>
<div class="summary-synopsis"><p>This function deletes the user associated with the user name passed as a parameter</p>
</div>
2018-08-10 14:58:29 -07:00
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#generate_password/0">generate_password()</a>
</div>
<div class="summary-synopsis"><p>Generates a password randomply</p>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#generate_user_name/0">generate_user_name()</a>
</div>
<div class="summary-synopsis"><p>Generates a valid user name randomply</p>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#generate_user_name/1">generate_user_name(user_name)</a>
</div>
<div class="summary-synopsis"><p>This function is exported for testing purposes</p>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#get_user/1">get_user(user)</a>
</div>
<div class="summary-synopsis"><p>Get a user from the database based in the user name</p>
</div>
2018-09-04 05:16:00 -07:00
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#list_users/0">list_users()</a>
</div>
<div class="summary-synopsis"><p>This function returns all the users stored in the database</p>
</div>
2018-08-10 14:58:29 -07:00
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#purge_banned_tokens/0">purge_banned_tokens()</a>
</div>
<div class="summary-synopsis"><p>This function deletes the banned tokens which already expired</p>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#remove_user/1">remove_user(user)</a>
</div>
<div class="summary-synopsis"><p>Deletes a user from the database based in the given user</p>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#token_banned?/1">token_banned?(token)</a>
</div>
<div class="summary-synopsis"><p>Checks if a token is banned or not</p>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#user_active?/1">user_active?(user)</a>
</div>
<div class="summary-synopsis"><p>Checks if a user is active</p>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#valid_token?/1">valid_token?(jwt_token)</a>
</div>
<div class="summary-synopsis"><p>Validates if a JWT token is valid</p>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#valid_user_name?/1">valid_user_name?(user_name)</a>
</div>
<div class="summary-synopsis"><p>Validates if a given user name is valid or not. It is valid if doesnt exist a user
with that name in the database already</p>
</div>
</div>
</div>
</section>
<section id="functions" class="details-list">
<h1 class="section-heading">
<a class="hover-link" href="#functions">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this section</span>
</a>
Functions
</h1>
<div class="detail" id="activate_user/1">
<div class="detail-header">
<a href="#activate_user/1" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<span class="signature">activate_user(user)</span>
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/auth.ex#L53" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
<div class="specs">
<pre>activate_user(<a href="POABackend.Auth.Models.User.html#t:t/0">POABackend.Auth.Models.User.t</a>()) ::
{:ok, <a href="POABackend.Auth.Models.User.html#t:t/0">POABackend.Auth.Models.User.t</a>()} | {:error, <a href="https://hexdocs.pm/ecto/2.1.6/Ecto.Changeset.html#t:t/0">Ecto.Changeset.t</a>()}</pre>
</div>
</div>
<section class="docstring">
<p>This function Activates a user, storing <code class="inline">active: true</code> in the database for the given user</p>
</section>
</div>
<div class="detail" id="authenticate_admin/2">
<div class="detail-header">
<a href="#authenticate_admin/2" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<span class="signature">authenticate_admin(admin_name, password)</span>
2018-09-05 05:08:57 -07:00
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/auth.ex#L120" class="view-source" rel="help" title="View Source">
2018-08-10 14:58:29 -07:00
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
<div class="specs">
<pre>authenticate_admin(<a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>(), <a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()) ::
{:ok, :valid} | {:error, :notvalid}</pre>
</div>
</div>
<section class="docstring">
<p>Authenticates an Admin</p>
</section>
</div>
<div class="detail" id="authenticate_user/2">
<div class="detail-header">
<a href="#authenticate_user/2" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<span class="signature">authenticate_user(user_name, password)</span>
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/auth.ex#L80" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
<div class="specs">
<pre>authenticate_user(<a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>(), <a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()) ::
{:ok, <a href="POABackend.Auth.Models.User.html#t:t/0">POABackend.Auth.Models.User.t</a>()} | {:error, :notvalid}</pre>
</div>
</div>
<section class="docstring">
<p>This function authenticates a user/password pair</p>
</section>
</div>
<div class="detail" id="create_banned_token/1">
<div class="detail-header">
<a href="#create_banned_token/1" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<span class="signature">create_banned_token(jwt_token)</span>
2018-09-05 05:08:57 -07:00
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/auth.ex#L180" class="view-source" rel="help" title="View Source">
2018-08-10 14:58:29 -07:00
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
<div class="specs">
<pre>create_banned_token(<a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()) ::
{:ok, <a href="POABackend.Auth.Models.Token.html#t:t/0">POABackend.Auth.Models.Token.t</a>()} | {:error, <a href="https://hexdocs.pm/elixir/typespecs.html#basic-types">any</a>()}</pre>
</div>
</div>
<section class="docstring">
<p>Creates a token entry in the banned tokens table. It receives a jwt token in String format.
This function will extract the expiration time from the claims and store them in the Database.</p>
</section>
</div>
<div class="detail" id="create_banned_token/2">
<div class="detail-header">
<a href="#create_banned_token/2" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<span class="signature">create_banned_token(token, expires)</span>
2018-09-05 05:08:57 -07:00
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/auth.ex#L194" class="view-source" rel="help" title="View Source">
2018-08-10 14:58:29 -07:00
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
<div class="specs">
<pre>create_banned_token(<a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>(), <a href="https://hexdocs.pm/elixir/typespecs.html#basic-types">integer</a>()) ::
{:ok, <a href="POABackend.Auth.Models.Token.html#t:t/0">POABackend.Auth.Models.Token.t</a>()} | {:error, :already_exists}</pre>
</div>
</div>
<section class="docstring">
<p>Creates a token entry in the banned tokens table. It receives the token in String format and the
expiration time as Integer.</p>
</section>
</div>
<div class="detail" id="create_user/3">
<span id="create_user/2"></span>
<div class="detail-header">
<a href="#create_user/3" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<span class="signature">create_user(user_name, password, active \\ true)</span>
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/auth.ex#L20" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
<div class="specs">
<pre>create_user(<a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>(), <a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>(), Boolean.t()) ::
{:ok, <a href="POABackend.Auth.Models.User.html#t:t/0">POABackend.Auth.Models.User.t</a>()}
| {:error, :already_exists}
| {:error, <a href="https://hexdocs.pm/ecto/2.1.6/Ecto.Changeset.html#t:t/0">Ecto.Changeset.t</a>()}</pre>
</div>
</div>
<section class="docstring">
<p>Registers a user in the system.</p>
</section>
</div>
<div class="detail" id="deactivate_user/1">
<div class="detail-header">
<a href="#deactivate_user/1" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<span class="signature">deactivate_user(user)</span>
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/auth.ex#L63" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
<div class="specs">
<pre>deactivate_user(<a href="POABackend.Auth.Models.User.html#t:t/0">POABackend.Auth.Models.User.t</a>()) ::
{:ok, <a href="POABackend.Auth.Models.User.html#t:t/0">POABackend.Auth.Models.User.t</a>()} | {:error, <a href="https://hexdocs.pm/ecto/2.1.6/Ecto.Changeset.html#t:t/0">Ecto.Changeset.t</a>()}</pre>
</div>
</div>
<section class="docstring">
<p>This function Deactivates a user, storing <code class="inline">active: false</code> in the database for the given user</p>
</section>
</div>
2018-09-05 05:08:57 -07:00
<div class="detail" id="delete_user/1">
<div class="detail-header">
<a href="#delete_user/1" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<span class="signature">delete_user(user_name)</span>
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/auth.ex#L106" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
<div class="specs">
<pre>delete_user(<a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()) :: {:ok, :deleted} | {:error, :notfound}</pre>
</div>
</div>
<section class="docstring">
<p>This function deletes the user associated with the user name passed as a parameter</p>
</section>
</div>
2018-08-10 14:58:29 -07:00
<div class="detail" id="generate_password/0">
<div class="detail-header">
<a href="#generate_password/0" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<span class="signature">generate_password()</span>
2018-09-05 05:08:57 -07:00
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/auth.ex#L155" class="view-source" rel="help" title="View Source">
2018-08-10 14:58:29 -07:00
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
<div class="specs">
<pre>generate_password() :: <a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()</pre>
</div>
</div>
<section class="docstring">
<p>Generates a password randomply</p>
</section>
</div>
<div class="detail" id="generate_user_name/0">
<div class="detail-header">
<a href="#generate_user_name/0" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<span class="signature">generate_user_name()</span>
2018-09-05 05:08:57 -07:00
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/auth.ex#L134" class="view-source" rel="help" title="View Source">
2018-08-10 14:58:29 -07:00
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
<div class="specs">
<pre>generate_user_name() :: <a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()</pre>
</div>
</div>
<section class="docstring">
<p>Generates a valid user name randomply</p>
</section>
</div>
<div class="detail" id="generate_user_name/1">
<div class="detail-header">
<a href="#generate_user_name/1" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<span class="signature">generate_user_name(user_name)</span>
2018-09-05 05:08:57 -07:00
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/auth.ex#L144" class="view-source" rel="help" title="View Source">
2018-08-10 14:58:29 -07:00
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
<div class="specs">
<pre>generate_user_name(<a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()) :: <a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()</pre>
</div>
</div>
<section class="docstring">
<p>This function is exported for testing purposes</p>
</section>
</div>
<div class="detail" id="get_user/1">
<div class="detail-header">
<a href="#get_user/1" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<span class="signature">get_user(user)</span>
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/auth.ex#L36" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
<div class="specs">
<pre>get_user(<a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()) :: <a href="POABackend.Auth.Models.User.html#t:t/0">POABackend.Auth.Models.User.t</a>() | nil</pre>
</div>
</div>
<section class="docstring">
<p>Get a user from the database based in the user name</p>
</section>
</div>
2018-09-04 05:16:00 -07:00
<div class="detail" id="list_users/0">
<div class="detail-header">
<a href="#list_users/0" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<span class="signature">list_users()</span>
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/auth.ex#L98" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
<div class="specs">
<pre>list_users() :: [<a href="POABackend.Auth.Models.User.html#t:t/0">POABackend.Auth.Models.User.t</a>()]</pre>
</div>
</div>
<section class="docstring">
<p>This function returns all the users stored in the database</p>
</section>
</div>
2018-08-10 14:58:29 -07:00
<div class="detail" id="purge_banned_tokens/0">
<div class="detail-header">
<a href="#purge_banned_tokens/0" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<span class="signature">purge_banned_tokens()</span>
2018-09-05 05:08:57 -07:00
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/auth.ex#L226" class="view-source" rel="help" title="View Source">
2018-08-10 14:58:29 -07:00
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
<div class="specs">
<pre>purge_banned_tokens() :: :ok</pre>
</div>
</div>
<section class="docstring">
<p>This function deletes the banned tokens which already expired</p>
</section>
</div>
<div class="detail" id="remove_user/1">
<div class="detail-header">
<a href="#remove_user/1" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<span class="signature">remove_user(user)</span>
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/auth.ex#L44" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
<div class="specs">
<pre>remove_user(<a href="POABackend.Auth.Models.User.html#t:t/0">POABackend.Auth.Models.User.t</a>()) :: :ok</pre>
</div>
</div>
<section class="docstring">
<p>Deletes a user from the database based in the given user</p>
</section>
</div>
<div class="detail" id="token_banned?/1">
<div class="detail-header">
<a href="#token_banned?/1" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<span class="signature">token_banned?(token)</span>
2018-09-05 05:08:57 -07:00
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/auth.ex#L243" class="view-source" rel="help" title="View Source">
2018-08-10 14:58:29 -07:00
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
<div class="specs">
<pre>token_banned?(<a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()) :: Boolean.t()</pre>
</div>
</div>
<section class="docstring">
<p>Checks if a token is banned or not</p>
</section>
</div>
<div class="detail" id="user_active?/1">
<div class="detail-header">
<a href="#user_active?/1" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<span class="signature">user_active?(user)</span>
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/auth.ex#L74" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
<div class="specs">
<pre>user_active?(<a href="POABackend.Auth.Models.User.html#t:t/0">POABackend.Auth.Models.User.t</a>()) :: Boolean.t()</pre>
</div>
</div>
<section class="docstring">
<p>Checks if a user is active</p>
</section>
</div>
<div class="detail" id="valid_token?/1">
<div class="detail-header">
<a href="#valid_token?/1" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<span class="signature">valid_token?(jwt_token)</span>
2018-09-05 05:08:57 -07:00
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/auth.ex#L208" class="view-source" rel="help" title="View Source">
2018-08-10 14:58:29 -07:00
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
<div class="specs">
<pre>valid_token?(<a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()) :: Boolean.t() | {:error, :token_expired}</pre>
</div>
</div>
<section class="docstring">
<p>Validates if a JWT token is valid.</p>
</section>
</div>
<div class="detail" id="valid_user_name?/1">
<div class="detail-header">
<a href="#valid_user_name?/1" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<span class="signature">valid_user_name?(user_name)</span>
2018-09-05 05:08:57 -07:00
<a href="https://github.com/poanetwork/poa-netstats-wharehouse/blob/v0.1.0/lib/poa_backend/auth.ex#L164" class="view-source" rel="help" title="View Source">
2018-08-10 14:58:29 -07:00
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
<div class="specs">
<pre>valid_user_name?(<a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()) :: Boolean.t()</pre>
</div>
</div>
<section class="docstring">
<p>Validates if a given user name is valid or not. It is valid if doesnt exist a user
with that name in the database already</p>
</section>
</div>
</section>
<footer class="footer">
<p>
<span class="line">
Built using
<a href="https://github.com/elixir-lang/ex_doc" title="ExDoc" rel="help" target="_blank">ExDoc</a> (v0.18.4),
</span>
<span class="line">
designed by
<a href="https://twitter.com/dignifiedquire" target="_blank" title="@dignifiedquire">Friedel Ziegelmayer</a>.
</span>
</p>
</footer>
</div>
</div>
</section>
</div>
<script src="dist/app-9bd040e5e5.js"></script>
</body>
</html>