bouncer v0.3.0 Bouncer.Session
A library of functions used to work with session data.
Summary
Functions
Destroys a session given a token and a user ID
Destroys all sessions associated with a given user ID
Generates a session token. The ttl (time-to-live) defaults to 2 weeks. See Bouncer.Token.Generate/4
Retrieves session data given an authorization token and puts it into the connection
Puts the user session data into the connection
Saves session data given a key and optional ttl (time-to-live)
Convenience function to determine if the ID from the current_user in the request matches the given User ID
Verifies a session token is valid and matches the given user. See Bouncer.Token.Verify/4
Functions
Generates a session token. The ttl (time-to-live) defaults to 2 weeks. See Bouncer.Token.Generate/4.
Retrieves session data given an authorization token and puts it into the connection.
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? %{private: %{current_user: %{"id" => 1}}},
...> 1
true
iex> Bouncer.Session.user_request? %{private: %{current_user: %{"id" => 1}}},
...> "1"
true
iex> Bouncer.Session.user_request? %{private: %{current_user: %{"id" => 1}}},
...> "2"
false
iex> Bouncer.Session.user_request? %{private: %{}}, 1
false