VoileWeb.UserAuthPaus (Voile v0.1.31)

Copy Markdown View Source

PAuS (Padjadjaran Authentication System) OAuth 2.0 integration Following the same pattern as UserAuthGoogle using Assent

Summary

Functions

Make API call to PAuS Can be used in controllers or LiveViews

OAuth callback handler Route: GET /auth/paus/callback

Fetch current PAuS user from session

LiveView on_mount callback for mounting PAuS user

Authorization request handler Route: GET /auth/paus

Sign out from PAuS and clear session Route: GET /auth/paus/logout

Functions

api(conn, path, params \\ %{})

Make API call to PAuS Can be used in controllers or LiveViews

Examples

# GET request
{:ok, profile} = VoileWeb.UserAuthPaus.api(conn, "/user/profile")

# POST request
{:ok, result} = VoileWeb.UserAuthPaus.api(conn, "/user/update", %{name: "New Name"})

callback(conn)

OAuth callback handler Route: GET /auth/paus/callback

fetch_paus_user(conn, opts)

Fetch current PAuS user from session

on_mount(atom, params, session, socket)

LiveView on_mount callback for mounting PAuS user

request(conn)

Authorization request handler Route: GET /auth/paus

sign_out(conn)

Sign out from PAuS and clear session Route: GET /auth/paus/logout