cipher v1.4.0 Cipher.ValidatePlug View Source

Plug that uses Cipher to validate signatures and halt with 401 when not valid. Use like this:

# ...
plug Cipher.ValidatePlug
# ...

Or pass an error_callback to be able to do things before halting with 401:

# ...
plug Cipher.ValidatePlug, error_callback: &MyApp.my_validation_error_logging_callback/2
# ...

def my_validation_error_logging_callback(conn, error) do
  # Do something with the `error` message and the `conn`, just like:
  Logger.info(error)
  # right before the plug halts with 401
end

# ...

Link to this section Summary

Link to this section Functions