Skip to content
Paul Oliynik edited this page Oct 31, 2016 · 1 revision

Basic Authentication

HealthMonitor API is not secure by default but since version 3.4.0.0 it supports basic authentication. To enable this feature you must specify Password field in the registration request body:

{
  "Name": "Google",
  "Address": "http://google.com",
  "MonitorType": "http",
  "Group": "Externals",
  "Password": "Some_password"
}

Note: Length of the password should be at least 8 chars.

There are three types of credentials for authorization:

  • Endpoint credentials (where username=EndpointId and password is specified via registration)
  • Admin credentials (stored in Api.SelfHost.config)
  • Monitor credentials (stored both in Api.SelfHost.config and Monitors.SelfHost.config)

Endpoint credentials allow to perform such requests:

  1. POST api/endpoints/{id}/health
  2. DELETE api/endpoints/{id}
  3. PUT api/endpoints/{id}/tags

Admin credentials allow to perform such requests:

  1. DELETE api/endpoints/{id}
  2. PUT api/endpoints/{id}/tags

And Monitor credentials allow to perform:

  1. POST api/endpoints/health
  2. POST api/monitors/register

To send authorized request you should provide Authorization Header like this:

new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes($"{endpointId}:{Password}")))

Note:

If endpoint was registered with password then you should use it in the body of every next registration request, not in authorization header.

Authorization on Swagger UI

To make it easier to perform auth on swagger you can use special form: swagger basic authentication This form appears only for urls which can reply with 401 or 403 statuses.

Clone this wiki locally