CouchDB replication with authentication and validation update handler

When using a validation update handler, one must use user_ctx when running the replication as an admin user. When using HTTPS and authentication on the remote database, one must use headers.

{
  "_id": "Replicate provisioning from server.example.net",
  "source": {
    "url": "https://server.example.net:6984/provisioning",
    "headers": {
      "Authorization": "Basic dXNlcjpwYXNzd29yZA=="
    }
  },
  "target": "provisioning",
  "continuous": true,
  "user_ctx": {
    "name": "admin",
    "roles": [
      "_admin",
      "provisioning_admin",
      "provisioning_writer"
    ]
  },
  "owner": "admin",
}

Note: with roles to include depend on which roles are used by the validation function(s).

Written on January 27, 2015