authsense travis-ci

Sensible authentication helpers for Phoenix/Ecto

Authsense

Sensible authentication helpers for Phoenix/Ecto

Status

Installation

Add authsense to your list of dependencies in mix.exs:

def deps do
  [{:authsense, "~> 0.3.0"}]
end

Overview

Please consult the Authsense documentation for full details.

Configure authsense:

config :authsense, Myapp.User,
   repo: Myapp.Repo

You can then call some helpers for authentication:

# For login actions
authenticate(changeset)  #=> {:ok, user} or {:error, changeset_with_errors}
authenticate({ "userid", "password" })  #=> %User{} | nil
# For login/logout actions
conn |> put_current_user(user)  # login
conn |> put_current_user(nil)   # logout
# For model changesets
changeset
|> generate_hashed_password()
# For controllers
import Authsense.Plug
plug :fetch_current_user
conn.assigns.current_user  #=> %User{} | nil

Please consult the Authsense documentation detailed info.

Thanks

authsense © 2016+, Rico Sta. Cruz. Released under the MIT License.
Authored and maintained by Rico Sta. Cruz with help from contributors (list).

ricostacruz.com  ·  GitHub @rstacruz  ·  Twitter @rstacruz

Related Repositories

authsense

authsense

Sensible authentication helpers for Phoenix/Ecto ...


Top Contributors

rstacruz victorsolis

Releases

-   v0.3.0 zip tar
-   v0.2.0 zip tar
-   v0.1.0 zip tar
-   v0.0.1 zip tar