Bouncer.Session
A library of functions used to work with session data.
Summary
Functions
Retrieves the specified session store adapter from the application config
Retrieves session data given an authorization token and assigns it to the connection
Assigns the user session data to the connection
Creates a session for a given user and saves it to the session store. Returns the session token which will be used as the API authorization token
Destroys a session by removing session data from the store
Verifies that the ID deciphered from the received token matches the ID in the session data
Convenience function to determine if the ID from the current_user in the request matches the given User ID
Functions
Retrieves session data given an authorization token and assigns it to the connection.
Creates a session for a given user and saves it to the session store. Returns the session token which will be used as the API authorization token.
Verifies that the ID deciphered from the received token matches the ID in the session data.
Convenience function to determine if the ID from the current_user in the request matches the given User ID.
examples
iex> Bouncer.Session.user_request? %{assigns: %{current_user: %{id: 1}}},
...> 1
true
iex> Bouncer.Session.user_request? %{assigns: %{current_user: %{id: 1}}},
...> "1"
true
iex> Bouncer.Session.user_request? %{assigns: %{current_user: %{id: 1}}},
...> "2"
false
iex> Bouncer.Session.user_request? %{assigns: %{}}, 1
false