@forgerock/javascript-sdk
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -7,2 +7,8 @@ # Changelog | ||
## [1.0.3] - 2020-01-06 | ||
### Added | ||
- Replaced `url` and `querystring` dependencies to avoid build issues in some environments | ||
## [1.0.2] - 2019-12-20 | ||
@@ -9,0 +15,0 @@ |
@@ -37,3 +37,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
import { resolve } from 'url'; | ||
import Config from '../config'; | ||
@@ -43,2 +42,3 @@ import { REQUESTED_WITH } from '../shared/constants'; | ||
import { withTimeout } from '../util/timeout'; | ||
import { resolve } from '../util/url'; | ||
/** | ||
@@ -45,0 +45,0 @@ * Provides direct access to the OpenAM authentication tree API. |
@@ -37,4 +37,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
import { stringify } from 'querystring'; | ||
import { resolve } from 'url'; | ||
import Config from '../config/index'; | ||
@@ -46,2 +44,3 @@ import TokenStorage from '../token-storage'; | ||
import { withTimeout } from '../util/timeout'; | ||
import { resolve, stringify } from '../util/url'; | ||
import { ResponseType } from './enums'; | ||
@@ -84,4 +83,8 @@ /** | ||
var iframe = document.createElement('iframe'); | ||
var onLoad = function () { }; | ||
var cleanUp = function () { }; | ||
// Define these here to avoid linter warnings | ||
var noop = function () { | ||
return; | ||
}; | ||
var onLoad = noop; | ||
var cleanUp = noop; | ||
var timeout = 0; | ||
@@ -88,0 +91,0 @@ cleanUp = function () { |
@@ -37,3 +37,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
import { resolve } from 'url'; | ||
import Config from '../config/index'; | ||
@@ -44,2 +43,3 @@ import { REQUESTED_WITH } from '../shared/constants'; | ||
import { withTimeout } from '../util/timeout'; | ||
import { resolve } from '../util/url'; | ||
/** | ||
@@ -46,0 +46,0 @@ * Provides access to the session management API. |
@@ -48,3 +48,2 @@ var __assign = (this && this.__assign) || function () { | ||
}; | ||
import { parse as parseUrl } from 'url'; | ||
import OAuth2Client, { ResponseType } from '../oauth2-client'; | ||
@@ -54,2 +53,3 @@ import TokenStorage from '../token-storage'; | ||
import PKCE from '../util/pkce'; | ||
import { parseQuery } from '../util/url'; | ||
var TokenManager = /** @class */ (function () { | ||
@@ -60,3 +60,3 @@ function TokenManager() { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var tokens, error_1, verifier, state, authorizeUrlOptions, authorizeUrl, parsedAuthorizeUrl, authorizationCode, getTokensOptions, error_2; | ||
var tokens, error_1, verifier, state, authorizeUrlOptions, authorizeUrl, parsedQuery, authorizationCode, getTokensOptions, error_2; | ||
return __generator(this, function (_a) { | ||
@@ -87,10 +87,10 @@ switch (_a.label) { | ||
authorizeUrl = _a.sent(); | ||
parsedAuthorizeUrl = parseUrl(authorizeUrl, true); | ||
if (parsedAuthorizeUrl.query.state !== state) { | ||
parsedQuery = parseQuery(authorizeUrl); | ||
if (parsedQuery.state !== state) { | ||
throw new Error('State mismatch'); | ||
} | ||
if (!parsedAuthorizeUrl.query.code || Array.isArray(parsedAuthorizeUrl.query.code)) { | ||
if (!parsedQuery.code || Array.isArray(parsedQuery.code)) { | ||
throw new Error('Failed to acquire authorization code'); | ||
} | ||
authorizationCode = parsedAuthorizeUrl.query.code; | ||
authorizationCode = parsedQuery.code; | ||
getTokensOptions = __assign(__assign({}, options), { authorizationCode: authorizationCode, verifier: verifier }); | ||
@@ -97,0 +97,0 @@ return [4 /*yield*/, OAuth2Client.getOAuth2Tokens(getTokensOptions)]; |
@@ -42,3 +42,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var url_1 = require("url"); | ||
var config_1 = __importDefault(require("../config")); | ||
@@ -48,2 +47,3 @@ var constants_1 = require("../shared/constants"); | ||
var timeout_1 = require("../util/timeout"); | ||
var url_1 = require("../util/url"); | ||
/** | ||
@@ -50,0 +50,0 @@ * Provides direct access to the OpenAM authentication tree API. |
@@ -42,4 +42,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var querystring_1 = require("querystring"); | ||
var url_1 = require("url"); | ||
var index_1 = __importDefault(require("../config/index")); | ||
@@ -51,2 +49,3 @@ var token_storage_1 = __importDefault(require("../token-storage")); | ||
var timeout_1 = require("../util/timeout"); | ||
var url_1 = require("../util/url"); | ||
var enums_1 = require("./enums"); | ||
@@ -90,4 +89,8 @@ exports.ResponseType = enums_1.ResponseType; | ||
var iframe = document.createElement('iframe'); | ||
var onLoad = function () { }; | ||
var cleanUp = function () { }; | ||
// Define these here to avoid linter warnings | ||
var noop = function () { | ||
return; | ||
}; | ||
var onLoad = noop; | ||
var cleanUp = noop; | ||
var timeout = 0; | ||
@@ -142,3 +145,3 @@ cleanUp = function () { | ||
} | ||
body = querystring_1.stringify(requestParams); | ||
body = url_1.stringify(requestParams); | ||
init = { | ||
@@ -241,3 +244,3 @@ body: body, | ||
// eslint-disable-next-line @typescript-eslint/camelcase | ||
body: querystring_1.stringify({ client_id: clientId, token: accessToken }), | ||
body: url_1.stringify({ client_id: clientId, token: accessToken }), | ||
credentials: 'include', | ||
@@ -316,3 +319,3 @@ headers: { 'content-type': 'application/x-www-form-urlencoded' }, | ||
if (query) { | ||
url += "?" + querystring_1.stringify(query); | ||
url += "?" + url_1.stringify(query); | ||
} | ||
@@ -319,0 +322,0 @@ return url; |
@@ -42,3 +42,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var url_1 = require("url"); | ||
var index_1 = __importDefault(require("../config/index")); | ||
@@ -49,2 +48,3 @@ var constants_1 = require("../shared/constants"); | ||
var timeout_1 = require("../util/timeout"); | ||
var url_1 = require("../util/url"); | ||
/** | ||
@@ -51,0 +51,0 @@ * Provides access to the session management API. |
@@ -60,3 +60,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var url_1 = require("url"); | ||
var oauth2_client_1 = __importStar(require("../oauth2-client")); | ||
@@ -66,2 +65,3 @@ var token_storage_1 = __importDefault(require("../token-storage")); | ||
var pkce_1 = __importDefault(require("../util/pkce")); | ||
var url_1 = require("../util/url"); | ||
var TokenManager = /** @class */ (function () { | ||
@@ -72,3 +72,3 @@ function TokenManager() { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var tokens, error_1, verifier, state, authorizeUrlOptions, authorizeUrl, parsedAuthorizeUrl, authorizationCode, getTokensOptions, error_2; | ||
var tokens, error_1, verifier, state, authorizeUrlOptions, authorizeUrl, parsedQuery, authorizationCode, getTokensOptions, error_2; | ||
return __generator(this, function (_a) { | ||
@@ -99,10 +99,10 @@ switch (_a.label) { | ||
authorizeUrl = _a.sent(); | ||
parsedAuthorizeUrl = url_1.parse(authorizeUrl, true); | ||
if (parsedAuthorizeUrl.query.state !== state) { | ||
parsedQuery = url_1.parseQuery(authorizeUrl); | ||
if (parsedQuery.state !== state) { | ||
throw new Error('State mismatch'); | ||
} | ||
if (!parsedAuthorizeUrl.query.code || Array.isArray(parsedAuthorizeUrl.query.code)) { | ||
if (!parsedQuery.code || Array.isArray(parsedQuery.code)) { | ||
throw new Error('Failed to acquire authorization code'); | ||
} | ||
authorizationCode = parsedAuthorizeUrl.query.code; | ||
authorizationCode = parsedQuery.code; | ||
getTokensOptions = __assign(__assign({}, options), { authorizationCode: authorizationCode, verifier: verifier }); | ||
@@ -109,0 +109,0 @@ return [4 /*yield*/, oauth2_client_1.default.getOAuth2Tokens(getTokensOptions)]; |
{ | ||
"name": "@forgerock/javascript-sdk", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "ForgeRock JavaScript SDK", | ||
@@ -5,0 +5,0 @@ "main": "./lib/", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
402
10152
734108