Auth.Session (auth v1.6.6)
Schema and helper functions for managing Sessions for People/Apps. The Epic is https://github.com/dwyl/auth/issues/30 however we have chosen to make this much simpler for now.
Link to this section Summary
Functions
changeset/2
validates the session data before inserting/updating.
end_session/1
update session to end it.
get/1
retrieves the current session from DB
based on conn.assigns.person data.
See tests: test/auth/session_test.exs for sample usage.
get_by_id/1
retrieves a session by id.
insert/1
inserts a session based on the data in the conn.assigns.person
i.e. we are extending our auth flow to include the concept of a session.
This will allow us to have multiple active sessions (i.e. devices/browsers)
for the same person/app.
So you can be logged in to an app from multiple devices.
start_session/1
starts the session and returns conn with conn.assigns.sid.
invokes insert/1
above but returns conn instead of the session record.
update_session_end/1
update session to end it.
Link to this section Functions
changeset(session, attrs)
changeset/2
validates the session data before inserting/updating.
end_session(conn)
end_session/1
update session to end it.
get(conn)
get/1
retrieves the current session from DB
based on conn.assigns.person data.
See tests: test/auth/session_test.exs for sample usage.
get_by_id(conn)
get_by_id/1
retrieves a session by id.
insert(conn, person)
insert/1
inserts a session based on the data in the conn.assigns.person
i.e. we are extending our auth flow to include the concept of a session.
This will allow us to have multiple active sessions (i.e. devices/browsers)
for the same person/app.
So you can be logged in to an app from multiple devices.
start_session(conn, person)
start_session/1
starts the session and returns conn with conn.assigns.sid.
invokes insert/1
above but returns conn instead of the session record.
update_session_end(conn)
update_session_end/1
update session to end it.