View Source Snap.Auth.Plain (Snap v0.12.1)

Implements HTTP Basic Auth, if necessary.

If the cluster config defines a username and password, an Authorization: Basic header is added to the request.

config :my_app, MyApp.Cluster,
  url: "http://localhost:9200",
  username: "foo",
  password: "bar

Or you can define a username and password in the URL itself:

config :my_app, MyApp.Cluster,
  url: "http://username:password@localhost:9200"

If no username or password is defined, no Authorization header is added, making it suitable for local development.

Summary

Functions

sign(config, method, path, headers, body)

Callback implementation for Snap.Auth.sign/5.