Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
riverrun committed Jun 5, 2015
1 parent e4a22d6 commit 5d38242
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@ An example of using Openmaize, an authentication library, in a Phoenix web
application.

To see how Openmaize is called, see the `config/dev.exs` and `web/router.ex`
files.
files. In addition, see the `web/controllers/admin_controller.ex` file
and the login and login_form templates to see how the login GET request
is handled. It is not necessary to write any logic for logging in and out,
as that is handled by Openmaize.

In this example, Openmaize is called for every connection and handles the
authentication of users using Json Web Tokens (JWTs). It also handles the
login and logout of users.

Openmaize uses roles to offer finer-grained protection, and so the user
model needs to have a `role` entry, as well as `id` and `name`. The "admin"
role is allowed complete access to anywhere on the site. In addition, if a
role's path is followed by an id, other users' pages can be viewed, but not
role is allowed complete access to anywhere on the site. There is also an
option to protect pages with ids so that other users' pages can be viewed, but not
edited. So, in this example, harry can view dick's page, but he is not
allowed to edit it. See the `config/dev.exs` file for an example of how
to configure role protection.
Expand Down
2 changes: 1 addition & 1 deletion config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ config :openmaize,
crypto: :bcrypt,
login_dir: "admin",
redirect_pages: %{"admin" => "/admin", "user" => "/users", nil => "/"},
protected: %{"/admin" => [], "/users" => ["user"]},
protected: %{"/admin" => [], "/users" => ["user"], "/users/:id" => ["user"]},
storage_method: "cookie",
secret_key: "you will never guess",
token_validity: 600
2 changes: 1 addition & 1 deletion config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ config :openmaize,
crypto: :bcrypt,
login_dir: "admin",
redirect_pages: %{"admin" => "/admin", "user" => "/users", nil => "/"},
protected: %{"/admin" => [], "/users" => ["user"]},
protected: %{"/admin" => [], "/users" => ["user"], "/users/:id" => ["user"]},
storage_method: "cookie",
secret_key: "you will never guess",
token_validity: 600

0 comments on commit 5d38242

Please sign in to comment.