Drop-in authentication support for Phoenix apps using AshAuthentication.
Find a file
dependabot[bot] a47204aec2
chore(deps): bump phoenix_live_view from 0.18.2 to 0.18.3 (#2)
Bumps [phoenix_live_view](https://github.com/phoenixframework/phoenix_live_view) from 0.18.2 to 0.18.3.
- [Release notes](https://github.com/phoenixframework/phoenix_live_view/releases)
- [Changelog](https://github.com/phoenixframework/phoenix_live_view/blob/master/CHANGELOG.md)
- [Commits](https://github.com/phoenixframework/phoenix_live_view/compare/v0.18.2...v0.18.3)

---
updated-dependencies:
- dependency-name: phoenix_live_view
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-27 14:41:14 +13:00
.devcontainer chore: set up devcontainer env. 2022-10-25 10:44:50 +13:00
.github chore: update dependabot.yml 2022-10-27 10:23:52 +13:00
config feat: Add support for PasswordAuthentication. 2022-10-25 17:02:56 +13:00
dev feat: Add support for PasswordAuthentication. 2022-10-25 17:02:56 +13:00
lib chore(docs): fix small documentation mistake. 2022-10-26 16:48:25 +13:00
test feat: Add support for PasswordAuthentication. 2022-10-25 17:02:56 +13:00
.doctor.exs feat: Add support for PasswordAuthentication. 2022-10-25 17:02:56 +13:00
.formatter.exs feat: Add support for PasswordAuthentication. 2022-10-25 17:02:56 +13:00
.gitignore chore: set up dev Phoenix server. 2022-10-25 11:23:05 +13:00
.tool-versions chore: set up devcontainer env. 2022-10-25 10:44:50 +13:00
CHANGELOG.md chore: release version v0.1.0 2022-10-25 17:07:08 +13:00
mix.exs chore(docs): tidy up docs. 2022-10-26 20:21:10 +13:00
mix.lock chore(deps): bump phoenix_live_view from 0.18.2 to 0.18.3 (#2) 2022-10-27 14:41:14 +13:00
README.md feat: Add support for PasswordAuthentication. 2022-10-25 17:02:56 +13:00

AshAuthentication.Phoenix

The ash_authentication_phoenix package extends ash_authentication by adding router helpers, plugs and behaviours that makes adding authentication to an existing Ash-based Phoenix application dead easy.

Installation

The package can be installed by adding ash_authentication_phoenix to your list of dependencies in mix.exs:

def deps do
  [
    {:ash_authentication_phoenix, "~> 0.1.0"}
  ]
end

Usage

This package assumes that you have Phoenix, Ash and AshAuthentication installed and configured. See their individual documentation for details.

This package is designed so that you can choose the level of customisation required. At the easiest level of configuration, you can just add the routes into your router:

defmodule MyAppWeb.Router do
  use MyAppWeb, :router
  use AshAuthentication.Phoenix.Router

  pipeline :browser do
    # ...
    plug(:load_from_session)
  end

  scope "/" do
    pipe_through :browser
    sign_in_route
    sign_out_route MyAppWeb.AuthController
    auth_routes MyAppWeb.AuthController
  end
end

This will give you a generic sign-in/registration page and store the authenticated user in the Phoenix session.

Customisation

There are several methods of customisation available depending on the level of control you would like:

  1. Use the generic sign-in liveview.
  2. Apply overrides to set your own CSS classes for all components.
  3. Build your own sign-in pages using the pre-defined components.
  4. Build your own sign-in pages using the generated auth routes.

Documentation

Documentation for the latest release will be available on hexdocs and for the main branch.

Contributing

  • To contribute updates, fixes or new features please fork and open a pull-request against main.
  • Please use conventional commits - this allows us to dynamically generate the changelog.
  • Feel free to ask any questions on out GitHub discussions page.