[cyb-59] JS fetch auth library

JS fetch auth library implementation.

According to @anwar6953 comments next changes are implemented:
1. Browser and NodeJS logic separated into different files;
2. Documentation improved;
3. Minor code corrections.

Files not required to be reviewed( dependecies for tests that could not be installed by 'npm' or 'bower' ):
1. cdap-authentication-clients/javascript/src/base64.js;
2. cdap-authentication-clients/javascript/test/formatio.js;
3. cdap-authentication-clients/javascript/test/samsam.js;
4. cdap-authentication-clients/javascript/test/sinon-server-1.10.3.js.
Changed. 
According to documentation there is no reason what path to request, server would answer with 401 error and auth uris in the http body. 

----- Original Message -----

From: "Ali Anwar" <notifications@github.com> 
To: "caskdata/cdap-clients" <cdap-clients@noreply.github.com> 
Cc: "kpovetkin" <kpovetkin@cybervisiontech.com> 
Sent: Monday, October 20, 2014 10:21:19 PM 
Subject: Re: [cdap-clients] [cyb-59] JS fetch auth library (#48) 



In cdap-authentication-clients/javascript/src/authmanager.js: 
> +            helpers = CDAPAuthHelpers.Browser;
> +            httpConnection = new XMLHttpRequest();
> +        } else {
> +            helpers = require('./helper-node');
> +            httpConnection = require('http-sync');
> +        }
> +
> +        var getAuthHeaders = helpers.getAuthHeaders.bind(this, AUTH_HEADER_NAME, AUTH_TYPE, connectionInfo),
> +            baseUrl = function () {
> +                return [
> +                    connectionInfo.ssl ? 'https' : 'http',
> +                    '://', connectionInfo.host,
> +                    ':', connectionInfo.port, '/'
> +                ].join('');
> +            },
> +            fetchAuthUrl = helpers.fetchAuthUrl.bind(this, httpConnection, baseUrl), 


This should be hitting the endpoing /v2/ping , instead of / . 

— 
Reply to this email directly or view it on GitHub .