Socket
Socket
Sign inDemoInstall

@splunkdev/cloud-auth-common

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@splunkdev/cloud-auth-common - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

src/util.d.ts

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

# [1.1.0](https://github.com/splunk/splunk-cloud-auth-js/compare/@splunkdev/cloud-auth-common@1.0.2...@splunkdev/cloud-auth-common@1.1.0) (2020-06-08)
### Features
* **cloud-auth-client:** store code_challenge and support accept_tos flag to support tos for pkce flow ([8b277c5](https://github.com/splunk/splunk-cloud-auth-js/commit/8b277c531f956d7b9a353d63cc110d092f02fc00))
## [1.0.2](https://github.com/splunk/splunk-cloud-auth-js/compare/@splunkdev/cloud-auth-common@1.0.1...@splunkdev/cloud-auth-common@1.0.2) (2020-04-02)

@@ -8,0 +19,0 @@

4

package.json
{
"name": "@splunkdev/cloud-auth-common",
"version": "1.0.2",
"version": "1.1.0",
"description": "Splunk Cloud Common Authentication Library for JavaScript",

@@ -143,3 +143,3 @@ "author": "Splunk, Inc.",

},
"gitHead": "39a8bb510e025493e6f89a345d5ce3eb7ec939bb"
"gitHead": "dbfc0043201c6f1668c502d3c9be6416e4a4f3c9"
}

@@ -66,2 +66,3 @@ /**

static readonly PATH_TOKEN_CSRF: string;
static readonly PATH_TOS: string;
/**

@@ -74,4 +75,5 @@ * Retrieves an access token using auth code and code verifier.

* @param redirectUri Redirect URI.
* @param acceptTos Accepted TOS.
*/
accessToken(clientId: string, authCode: string, codeVerifier: string, redirectUri: string): Promise<AccessTokenResponse>;
accessToken(clientId: string, authCode: string, codeVerifier: string, redirectUri: string, acceptTos?: string): Promise<AccessTokenResponse>;
/**

@@ -78,0 +80,0 @@ * Gets an authorization code for PKCE auth flow.

@@ -71,2 +71,3 @@ "use strict";

var splunk_auth_error_1 = require("./splunk-auth-error");
var util_1 = require("./util");
var HEADERS_APPLICATION_JSON = {

@@ -98,4 +99,5 @@ 'Accept': 'application/json',

* @param redirectUri Redirect URI.
* @param acceptTos Accepted TOS.
*/
AuthProxy.prototype.accessToken = function (clientId, authCode, codeVerifier, redirectUri) {
AuthProxy.prototype.accessToken = function (clientId, authCode, codeVerifier, redirectUri, acceptTos) {
return __awaiter(this, void 0, void 0, function () {

@@ -111,2 +113,5 @@ var body;

]);
if (acceptTos) {
body.set('accept_tos', acceptTos);
}
return [2 /*return*/, this._token(HEADERS_APPLICATION_JSON_URLENCODED, body)];

@@ -147,6 +152,3 @@ });

]);
queryParameterString = '?';
queryParameterMap.forEach(function (value, key) {
queryParameterString += encodeURIComponent(key) + "=" + encodeURIComponent(value) + "&";
});
queryParameterString = util_1.generateQueryParameters(queryParameterMap);
authorizeBaseUrl = new URL(AuthProxy.PATH_AUTHORIZATION, this.host);

@@ -198,9 +200,3 @@ authorizeUrl = new URL(queryParameterString, authorizeBaseUrl.href);

]);
queryParameterString = '?';
queryParameterMap.forEach(function (value, key) {
var stringValue = String(value);
if (stringValue !== 'undefined' && stringValue !== 'null' && stringValue !== '') {
queryParameterString += encodeURIComponent(key) + "=" + encodeURIComponent(stringValue) + "&";
}
});
queryParameterString = util_1.generateQueryParameters(queryParameterMap);
authorizeBaseUrl = new URL(AuthProxy.PATH_AUTHORIZATION, this.host);

@@ -350,6 +346,4 @@ authorizeUrl = new URL(queryParameterString, authorizeBaseUrl.href);

tokenUrl = new URL(AuthProxy.PATH_TOKEN, this.host);
formUrlEncodedBody = '';
body.forEach(function (value, key) {
formUrlEncodedBody += encodeURIComponent(key) + "=" + encodeURIComponent(value) + "&";
});
formUrlEncodedBody = util_1.generateQueryParameters(body);
formUrlEncodedBody = formUrlEncodedBody.slice(1);
return [2 /*return*/, fetch(tokenUrl.href, {

@@ -363,3 +357,4 @@ headers: headers,

if (!json.access_token) {
throw new splunk_auth_error_1.SplunkAuthError("Unable to authenticate and retrieve access_token. ErrorCode='" + json.code + "'");
throw new splunk_auth_error_1.SplunkAuthError('Unable to authenticate and retrieve access_token.' +
("Error='" + json.error + "' ErrorCode='" + json.code + "'"));
}

@@ -376,2 +371,3 @@ return json;

AuthProxy.PATH_TOKEN_CSRF = '/csrfToken';
AuthProxy.PATH_TOS = '/tos';
return AuthProxy;

@@ -378,0 +374,0 @@ }());

@@ -19,1 +19,2 @@ /**

export { SplunkAuthError } from './splunk-auth-error';
export { generateQueryParameters } from './util';

@@ -26,2 +26,4 @@ "use strict";

exports.SplunkAuthError = splunk_auth_error_1.SplunkAuthError;
var util_1 = require("./util");
exports.generateQueryParameters = util_1.generateQueryParameters;
//# sourceMappingURL=index.js.map

@@ -20,5 +20,5 @@ /**

useragent:'client-js',
version: '1.0.2',
version: '1.1.0',
branch: 'HEAD',
commit: '39a8bb5',
commit: 'dbfc004',
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc