const basicAuth = require('basic-auth');

function unauthorized(response) {
  response.set('WWW-Authenticate', 'Basic realm=Authorization Required');
  return response.send(401);
}

function basicAuthentication(request, response, next) {
  const user = basicAuth(request);

  if (!user || !user.name || !user.pass) {
    return unauthorized(response);
  }

  if (user.name === 'sumo' && user.pass === 'sumo') {
    return next();
  }

  return unauthorized(response);
}

exports.basicAuthentication = basicAuthentication;

@@ -1,46 +1,232 @@
-const basicAuth = require('basic-auth');%0A%0A
+// Derived from http://www.9bitstudios.com/2015/10/basic-authentication-in-node-js-express-applications-and-apis/%0A%0Avar basicAuth = require('basic-auth');%0A %0Aexports.basicAuthentication = function(request, response, next) %7B%0A %0A    
 func
@@ -255,16 +255,22 @@
 onse) %7B%0A
+      
   respon
@@ -335,16 +335,22 @@
 ired');%0A
+      
   return
@@ -374,74 +374,24 @@
 1);%0A
-%7D%0A%0Afunction basicAuthentication(request, response, next) %7B%0A  const
+    %7D;%0A %0A    var
  use
@@ -414,17 +414,20 @@
 quest);%0A
-%0A
+ %0A  
   if (!u
@@ -457,24 +457,28 @@
 ser.pass) %7B%0A
+    
     return u
@@ -502,19 +502,25 @@
 nse);%0A  
-%7D%0A%0A
+  %7D;%0A %0A  
   if (us
@@ -565,24 +565,28 @@
 umo') %7B%0A    
+  
+  
 return next(
@@ -590,19 +590,33 @@
 xt();%0A  
-%7D%0A%0A
+  %7D else %7B%0A      
   return
@@ -644,58 +644,21 @@
 e);%0A
-%7D%0A%0Aexports.basicAuthentication = basicAuthentication
+    %7D;%0A     %0A%7D
 ;%0A
+%0A

Revert "Apply eslint feedback to lib/authentication.js."