You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by cs...@apache.org on 2017/08/28 19:24:23 UTC

[incubator-openwhisk-package-cloudant] branch master updated: When auth header is missing send WWW-Authenticate header and a 401 (#127)

This is an automated email from the ASF dual-hosted git repository.

csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-package-cloudant.git


The following commit(s) were added to refs/heads/master by this push:
     new d5c36b7  When auth header is missing send WWW-Authenticate header and a 401 (#127)
d5c36b7 is described below

commit d5c36b799a64a49871e4532e9d4dc1fed568c255
Author: Jason Peterson <ja...@us.ibm.com>
AuthorDate: Mon Aug 28 15:24:21 2017 -0400

    When auth header is missing send WWW-Authenticate header and a 401 (#127)
---
 provider/lib/utils.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/provider/lib/utils.js b/provider/lib/utils.js
index bca66cb..f7cd444 100644
--- a/provider/lib/utils.js
+++ b/provider/lib/utils.js
@@ -373,7 +373,9 @@ module.exports = function(
         if (utils.endpointAuth) {
 
             if (!req.headers.authorization) {
-                return utils.sendError(method, HttpStatus.BAD_REQUEST, 'Malformed request, authentication header expected', res);
+                res.set('www-authenticate', 'Basic realm="Private"');
+                res.status(HttpStatus.UNAUTHORIZED);
+                return res.send('');
             }
 
             var parts = req.headers.authorization.split(' ');

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].