Curator.SessionKeeper v0.1.0 Curator.SessionKeeper.Plug.EnsureAuthenticated

This plug ensures that a valid JWT was provided and has been verified on the request.

If one is not found, the unauthenticated/2 function is invoked with the Plug.Conn.t object and its params.

Example

# Will call the unauthenticated/2 function on your handler
plug Curator.SessionKeeper.Plug.EnsureAuthenticated, handler: SomeModule

# look in the :secret location.  You can also do simple claim checks:
plug Curator.SessionKeeper.Plug.EnsureAuthenticated, handler: SomeModule, key: :secret

If the handler option is not passed, Curator.SessionKeeper.Plug.ErrorHandler will provide the default behavior.