code: function registerBasicAuth(app, authConfig) {
      if (typeof authConfig.user !== 'string' || typeof authConfig.password !== 'string') return;
      app.use((req, res, next) => {
        let credentials = basicAuth(req);
        if (!credentials || credentials.name !== authConfig.user || credentials.pass !== authConfig.password) {
          res.setHeader('WWW-Authenticate', `Basic realm="${config.realm || 'app'}"`);
          return next(thorin.error('UNAUTHORIZED', 'Authorization failed', 401));
        }
        next();
      });
    }
docs: /*
  Registers basic authorization