plug_password v0.3.3 PlugPassword.Block

Plug used to add simple authentication.

Options should be provided with at least passwords field.

Possible options:

  • :passwords - list of passwords that should allow users to pass authentication. Example: [“hello”, “world”]
  • :template - module which implement PlugPassword.Template.Behaviour. Example: MyApp.PlugPassword.Template
  • :path_whitelist - regex which will be used to check if path is whitelisted. Example: ~r/users/
  • :ip_whitelist - list of IPs that should be whitelisted. Example: [“”]
  • :custom_rule - function which is run with conn so you can implement custom rules. Example:

          f(conn) -> conn.port == 80 end




  plug PlugPassword.Block, passwords: ["hello", world],
    template: Authentication,
    path_whitelist: ~r/users/,
    ip_whitelist: [""],
    custom_rule: &Authentication.custom_rule/1

Link to this section Summary


Checks if password is matching

Link to this section Functions

Link to this function call(conn, options)

Checks if password is matching.

If password will match or any of additional checks will return true, user will be authenticated. Otherwise it will render form.