@forgerock/javascript-sdk
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -7,2 +7,8 @@ # Changelog | ||
## [1.0.5] - 2020-01-16 | ||
### Added | ||
- Support for additional querystring parameters (e.g. `suspendedId`) when invoking authentication trees | ||
## [1.0.4] - 2020-01-06 | ||
@@ -9,0 +15,0 @@ |
@@ -1,3 +0,2 @@ | ||
import { ConfigOptions } from '../config'; | ||
import { Step } from './interfaces'; | ||
import { Step, StepOptions } from './interfaces'; | ||
/** | ||
@@ -11,6 +10,6 @@ * Provides direct access to the OpenAM authentication tree API. | ||
* @param {Step} previousStep The previous step, including any required input. | ||
* @param {ConfigOptions} options Configuration default overrides. | ||
* @param {StepOptions} options Configuration default overrides. | ||
* @return {Step} The next step in the authentication tree. | ||
*/ | ||
static next(previousStep?: Step, options?: ConfigOptions): Promise<Step>; | ||
static next(previousStep?: Step, options?: StepOptions): Promise<Step>; | ||
private static constructUrl; | ||
@@ -17,0 +16,0 @@ private static configureRequest; |
@@ -0,1 +1,12 @@ | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -41,3 +52,3 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
import { withTimeout } from '../util/timeout'; | ||
import { resolve } from '../util/url'; | ||
import { resolve, stringify } from '../util/url'; | ||
/** | ||
@@ -53,3 +64,3 @@ * Provides direct access to the OpenAM authentication tree API. | ||
* @param {Step} previousStep The previous step, including any required input. | ||
* @param {ConfigOptions} options Configuration default overrides. | ||
* @param {StepOptions} options Configuration default overrides. | ||
* @return {Step} The next step in the authentication tree. | ||
@@ -59,3 +70,3 @@ */ | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, realmPath, serverConfig, tree, url, init, res, json; | ||
var _a, realmPath, serverConfig, tree, query, url, init, res, json; | ||
return __generator(this, function (_b) { | ||
@@ -65,3 +76,4 @@ switch (_b.label) { | ||
_a = Config.get(options), realmPath = _a.realmPath, serverConfig = _a.serverConfig, tree = _a.tree; | ||
url = this.constructUrl(serverConfig, realmPath, tree); | ||
query = options ? options.query : {}; | ||
url = this.constructUrl(serverConfig, realmPath, tree, query); | ||
init = this.configureRequest(previousStep); | ||
@@ -79,6 +91,8 @@ return [4 /*yield*/, withTimeout(fetch(url, init), serverConfig.timeout)]; | ||
}; | ||
Auth.constructUrl = function (serverConfig, realmPath, tree) { | ||
Auth.constructUrl = function (serverConfig, realmPath, tree, query) { | ||
var realmUrlPath = getRealmUrlPath(realmPath); | ||
var query = tree ? "?authIndexType=service&authIndexValue=" + tree : ''; | ||
var path = "json/" + realmUrlPath + "/authenticate" + query; | ||
var treeParams = tree ? { authIndexType: 'service', authIndexValue: tree } : undefined; | ||
var params = __assign(__assign({}, query), treeParams); | ||
var queryString = Object.keys(params).length > 0 ? "?" + stringify(params) : ''; | ||
var path = "json/" + realmUrlPath + "/authenticate" + queryString; | ||
var url = resolve(serverConfig.baseUrl, path); | ||
@@ -85,0 +99,0 @@ return url; |
@@ -0,1 +1,3 @@ | ||
import { ConfigOptions } from '../config/interfaces'; | ||
import { StringDict } from '../shared/interfaces'; | ||
import { CallbackType } from './enums'; | ||
@@ -28,2 +30,9 @@ /** | ||
/** | ||
* Represents configuration overrides used when requesting the next | ||
* step in an authentication tree. | ||
*/ | ||
interface StepOptions extends ConfigOptions { | ||
query?: StringDict<string>; | ||
} | ||
/** | ||
* Represents failed policies for a matching property. | ||
@@ -68,2 +77,2 @@ */ | ||
} | ||
export { Callback, FailedPolicyRequirement, NameValue, PolicyParams, PolicyRequirement, Step, StepDetail, }; | ||
export { Callback, FailedPolicyRequirement, NameValue, PolicyParams, PolicyRequirement, Step, StepDetail, StepOptions, }; |
@@ -1,2 +0,2 @@ | ||
import { ConfigOptions } from '../config'; | ||
import { StepOptions } from '../auth/interfaces'; | ||
import FRLoginFailure from './fr-login-failure'; | ||
@@ -41,4 +41,4 @@ import FRLoginSuccess from './fr-login-success'; | ||
*/ | ||
static next(previousStep?: FRStep, options?: ConfigOptions): Promise<FRStep | FRLoginSuccess | FRLoginFailure>; | ||
static next(previousStep?: FRStep, options?: StepOptions): Promise<FRStep | FRLoginSuccess | FRLoginFailure>; | ||
} | ||
export default FRAuth; |
@@ -18,3 +18,3 @@ import HiddenValueCallback from '../fr-auth/callbacks/hidden-value-callback'; | ||
* } else if (stepType === WebAuthnStepType.Authentication) { | ||
* // Authenticate with existing device | ||
* // Authenticate with a registered device | ||
* await FRWebAuthn.authenticate(step); | ||
@@ -21,0 +21,0 @@ * } |
@@ -63,3 +63,3 @@ var __assign = (this && this.__assign) || function () { | ||
* } else if (stepType === WebAuthnStepType.Authentication) { | ||
* // Authenticate with existing device | ||
* // Authenticate with a registered device | ||
* await FRWebAuthn.authenticate(step); | ||
@@ -66,0 +66,0 @@ * } |
@@ -1,2 +0,2 @@ | ||
interface NameValue<T> { | ||
interface StringDict<T> { | ||
[name: string]: T; | ||
@@ -9,2 +9,2 @@ } | ||
} | ||
export { NameValue, Tokens }; | ||
export { StringDict, Tokens }; |
import { Tokens } from '../shared/interfaces'; | ||
/** @hidden */ | ||
interface TokenDbEventTarget extends EventTarget { | ||
result?: Tokens; | ||
} | ||
/** @hidden */ | ||
interface TokenDbEvent extends Event { | ||
@@ -6,0 +8,0 @@ target: TokenDbEventTarget | null; |
/** | ||
* Helper class for generating verifier and challenge strings for PKCE. | ||
* Helper class for generating verifier and challenge strings used for | ||
* Proof Key for Code Exchange (PKCE). | ||
*/ | ||
@@ -12,3 +13,3 @@ declare abstract class PKCE { | ||
/** | ||
* Creates a SDH-256 hash of the verifier. | ||
* Creates a SHA-256 hash of the verifier. | ||
* | ||
@@ -19,3 +20,3 @@ * @param verifier The verifier to hash | ||
/** | ||
* Creates a base-64 encoded url-friendly version of the specified array. | ||
* Creates a base64 encoded, URL-friendly version of the specified array. | ||
* | ||
@@ -22,0 +23,0 @@ * @param array The array of numbers to encode |
@@ -38,3 +38,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
/** | ||
* Helper class for generating verifier and challenge strings for PKCE. | ||
* Helper class for generating verifier and challenge strings used for | ||
* Proof Key for Code Exchange (PKCE). | ||
*/ | ||
@@ -57,3 +58,3 @@ var PKCE = /** @class */ (function () { | ||
/** | ||
* Creates a SDH-256 hash of the verifier. | ||
* Creates a SHA-256 hash of the verifier. | ||
* | ||
@@ -77,3 +78,3 @@ * @param verifier The verifier to hash | ||
/** | ||
* Creates a base-64 encoded url-friendly version of the specified array. | ||
* Creates a base64 encoded, URL-friendly version of the specified array. | ||
* | ||
@@ -80,0 +81,0 @@ * @param array The array of numbers to encode |
@@ -1,2 +0,2 @@ | ||
import { NameValue } from '../shared/interfaces'; | ||
import { StringDict } from '../shared/interfaces'; | ||
/** | ||
@@ -8,4 +8,4 @@ * Returns the base URL including protocol, hostname and any non-standard port. | ||
declare function resolve(baseUrl: string, path: string): string; | ||
declare function parseQuery(fullUrl: string): NameValue<string>; | ||
declare function stringify(data: NameValue<string | undefined>): string; | ||
declare function parseQuery(fullUrl: string): StringDict<string>; | ||
declare function stringify(data: StringDict<string | undefined>): string; | ||
export { getBaseUrl, parseQuery, resolve, stringify }; |
@@ -1,3 +0,2 @@ | ||
import { ConfigOptions } from '../config'; | ||
import { Step } from './interfaces'; | ||
import { Step, StepOptions } from './interfaces'; | ||
/** | ||
@@ -11,6 +10,6 @@ * Provides direct access to the OpenAM authentication tree API. | ||
* @param {Step} previousStep The previous step, including any required input. | ||
* @param {ConfigOptions} options Configuration default overrides. | ||
* @param {StepOptions} options Configuration default overrides. | ||
* @return {Step} The next step in the authentication tree. | ||
*/ | ||
static next(previousStep?: Step, options?: ConfigOptions): Promise<Step>; | ||
static next(previousStep?: Step, options?: StepOptions): Promise<Step>; | ||
private static constructUrl; | ||
@@ -17,0 +16,0 @@ private static configureRequest; |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -57,3 +68,3 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
* @param {Step} previousStep The previous step, including any required input. | ||
* @param {ConfigOptions} options Configuration default overrides. | ||
* @param {StepOptions} options Configuration default overrides. | ||
* @return {Step} The next step in the authentication tree. | ||
@@ -63,3 +74,3 @@ */ | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, realmPath, serverConfig, tree, url, init, res, json; | ||
var _a, realmPath, serverConfig, tree, query, url, init, res, json; | ||
return __generator(this, function (_b) { | ||
@@ -69,3 +80,4 @@ switch (_b.label) { | ||
_a = config_1.default.get(options), realmPath = _a.realmPath, serverConfig = _a.serverConfig, tree = _a.tree; | ||
url = this.constructUrl(serverConfig, realmPath, tree); | ||
query = options ? options.query : {}; | ||
url = this.constructUrl(serverConfig, realmPath, tree, query); | ||
init = this.configureRequest(previousStep); | ||
@@ -83,6 +95,8 @@ return [4 /*yield*/, timeout_1.withTimeout(fetch(url, init), serverConfig.timeout)]; | ||
}; | ||
Auth.constructUrl = function (serverConfig, realmPath, tree) { | ||
Auth.constructUrl = function (serverConfig, realmPath, tree, query) { | ||
var realmUrlPath = realm_1.getRealmUrlPath(realmPath); | ||
var query = tree ? "?authIndexType=service&authIndexValue=" + tree : ''; | ||
var path = "json/" + realmUrlPath + "/authenticate" + query; | ||
var treeParams = tree ? { authIndexType: 'service', authIndexValue: tree } : undefined; | ||
var params = __assign(__assign({}, query), treeParams); | ||
var queryString = Object.keys(params).length > 0 ? "?" + url_1.stringify(params) : ''; | ||
var path = "json/" + realmUrlPath + "/authenticate" + queryString; | ||
var url = url_1.resolve(serverConfig.baseUrl, path); | ||
@@ -89,0 +103,0 @@ return url; |
@@ -0,1 +1,3 @@ | ||
import { ConfigOptions } from '../config/interfaces'; | ||
import { StringDict } from '../shared/interfaces'; | ||
import { CallbackType } from './enums'; | ||
@@ -28,2 +30,9 @@ /** | ||
/** | ||
* Represents configuration overrides used when requesting the next | ||
* step in an authentication tree. | ||
*/ | ||
interface StepOptions extends ConfigOptions { | ||
query?: StringDict<string>; | ||
} | ||
/** | ||
* Represents failed policies for a matching property. | ||
@@ -68,2 +77,2 @@ */ | ||
} | ||
export { Callback, FailedPolicyRequirement, NameValue, PolicyParams, PolicyRequirement, Step, StepDetail, }; | ||
export { Callback, FailedPolicyRequirement, NameValue, PolicyParams, PolicyRequirement, Step, StepDetail, StepOptions, }; |
@@ -1,2 +0,2 @@ | ||
import { ConfigOptions } from '../config'; | ||
import { StepOptions } from '../auth/interfaces'; | ||
import FRLoginFailure from './fr-login-failure'; | ||
@@ -41,4 +41,4 @@ import FRLoginSuccess from './fr-login-success'; | ||
*/ | ||
static next(previousStep?: FRStep, options?: ConfigOptions): Promise<FRStep | FRLoginSuccess | FRLoginFailure>; | ||
static next(previousStep?: FRStep, options?: StepOptions): Promise<FRStep | FRLoginSuccess | FRLoginFailure>; | ||
} | ||
export default FRAuth; |
@@ -18,3 +18,3 @@ import HiddenValueCallback from '../fr-auth/callbacks/hidden-value-callback'; | ||
* } else if (stepType === WebAuthnStepType.Authentication) { | ||
* // Authenticate with existing device | ||
* // Authenticate with a registered device | ||
* await FRWebAuthn.authenticate(step); | ||
@@ -21,0 +21,0 @@ * } |
@@ -67,3 +67,3 @@ "use strict"; | ||
* } else if (stepType === WebAuthnStepType.Authentication) { | ||
* // Authenticate with existing device | ||
* // Authenticate with a registered device | ||
* await FRWebAuthn.authenticate(step); | ||
@@ -70,0 +70,0 @@ * } |
@@ -1,2 +0,2 @@ | ||
interface NameValue<T> { | ||
interface StringDict<T> { | ||
[name: string]: T; | ||
@@ -9,2 +9,2 @@ } | ||
} | ||
export { NameValue, Tokens }; | ||
export { StringDict, Tokens }; |
import { Tokens } from '../shared/interfaces'; | ||
/** @hidden */ | ||
interface TokenDbEventTarget extends EventTarget { | ||
result?: Tokens; | ||
} | ||
/** @hidden */ | ||
interface TokenDbEvent extends Event { | ||
@@ -6,0 +8,0 @@ target: TokenDbEventTarget | null; |
/** | ||
* Helper class for generating verifier and challenge strings for PKCE. | ||
* Helper class for generating verifier and challenge strings used for | ||
* Proof Key for Code Exchange (PKCE). | ||
*/ | ||
@@ -12,3 +13,3 @@ declare abstract class PKCE { | ||
/** | ||
* Creates a SDH-256 hash of the verifier. | ||
* Creates a SHA-256 hash of the verifier. | ||
* | ||
@@ -19,3 +20,3 @@ * @param verifier The verifier to hash | ||
/** | ||
* Creates a base-64 encoded url-friendly version of the specified array. | ||
* Creates a base64 encoded, URL-friendly version of the specified array. | ||
* | ||
@@ -22,0 +23,0 @@ * @param array The array of numbers to encode |
@@ -40,3 +40,4 @@ "use strict"; | ||
/** | ||
* Helper class for generating verifier and challenge strings for PKCE. | ||
* Helper class for generating verifier and challenge strings used for | ||
* Proof Key for Code Exchange (PKCE). | ||
*/ | ||
@@ -59,3 +60,3 @@ var PKCE = /** @class */ (function () { | ||
/** | ||
* Creates a SDH-256 hash of the verifier. | ||
* Creates a SHA-256 hash of the verifier. | ||
* | ||
@@ -79,3 +80,3 @@ * @param verifier The verifier to hash | ||
/** | ||
* Creates a base-64 encoded url-friendly version of the specified array. | ||
* Creates a base64 encoded, URL-friendly version of the specified array. | ||
* | ||
@@ -82,0 +83,0 @@ * @param array The array of numbers to encode |
@@ -1,2 +0,2 @@ | ||
import { NameValue } from '../shared/interfaces'; | ||
import { StringDict } from '../shared/interfaces'; | ||
/** | ||
@@ -8,4 +8,4 @@ * Returns the base URL including protocol, hostname and any non-standard port. | ||
declare function resolve(baseUrl: string, path: string): string; | ||
declare function parseQuery(fullUrl: string): NameValue<string>; | ||
declare function stringify(data: NameValue<string | undefined>): string; | ||
declare function parseQuery(fullUrl: string): StringDict<string>; | ||
declare function stringify(data: StringDict<string | undefined>): string; | ||
export { getBaseUrl, parseQuery, resolve, stringify }; |
{ | ||
"name": "@forgerock/javascript-sdk", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
737754
10206