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

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

Link to this function

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

View Source

Callback implementation for Snap.Auth.sign/5.