Guardian v0.13.0 Guardian.Plug.EnsureNotAuthenticated

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

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

Example

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

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

plug Guardian.Plug.EnsureNotAuthenticated, handler: SomeModule,
                                           typ: "access"

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