Curator.SessionKeeper v0.1.0 Curator.SessionKeeper.Plug
Curator.SessionKeeper.Plug contains functions that assist with interacting with Curator.SessionKeeper via Plugs.
Curator.SessionKeeper.Plug is not itself a plug.
Example
Curator.SessionKeeper.Plug.sign_in(conn, user)
Curator.SessionKeeper.Plug.sign_in(conn, user)
# stores this claims in a different location (keyed by :secret)
Curator.SessionKeeper.Plug.sign_in(
conn,
user,
%{ claims: "i", make: true, key: :secret }
)
Example
Curator.SessionKeeper.Plug.sign_out(conn) # sign out all sessions
Curator.SessionKeeper.Plug.sign_out(conn, :secret) # sign out only the :secret session
Then use the Curator.SessionKeeper.Plug helpers to look up claims and current_resource.
Example
Curator.SessionKeeper.Plug.claims(conn)
Curator.SessionKeeper.Plug.current_resource(conn)
Summary
Functions
A simple check to see if a request is authenticated
A simple check to see if a request is authenticated
Fetch the currently verified claims from the current request
Fetch the currently authenticated resource if loaded, optionally located at a location (key)
Sign in a resource (that your configured serializer knows about) into the current web session
Same as sign_in/3 but also encodes all claims into the default claims
Sign out of a session
Functions
A simple check to see if a request is authenticated
A simple check to see if a request is authenticated
claims(Plug.Conn.t, atom) :: {:ok, map} | {:error, atom | String.t}
Fetch the currently verified claims from the current request
Fetch the currently authenticated resource if loaded, optionally located at a location (key)
Sign in a resource (that your configured serializer knows about) into the current web session.
Same as sign_in/3 but also encodes all claims into the default claims.
The :key key in the claims map is special in that it
sets the location of the storage.
Example
Curator.SessionKeeper.sign_in(conn, user, :access)