gandalf v0.2.0 Gandalf.Helper
Gandalf helper to check authentications with scopes and returns resouce owner.
Summary
Functions
Authenticate user by using configured authorization methods and scopes
Functions
Authenticate user by using configured authorization methods and scopes.
Examples
required_scopes = ~w(read write)
result = Gandalf.Plug.Authenticate.authorize_for_resource(conn,
required_scopes)
case result do
{:error, errors, _} -> IO.inspect(errors)
nil -> IO.puts("not authencated!")
{:ok, current_user} -> IO.puts(current_user.email)
end