Guardian v0.14.5 Guardian.Plug.EnsureResource

This plug ensures that the current_resource has been set, usually in Guardian.Plug.LoadResource.

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

Example

# Will call the no_resource/2 function on your handler
plug Guardian.Plug.EnsureResource, handler: SomeModule

# look in the :secret location.
plug Guardian.Plug.EnsureResource, handler: SomeModule, key: :secret

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