samlify 2.8.6 → 2.8.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,7 +25,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
25
25
  return to.concat(ar || Array.prototype.slice.call(from));
26
26
  };
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.notEmpty = exports.isNonEmptyArray = exports.readPrivateKey = exports.inflateString = exports.base64Decode = exports.isString = exports.get = exports.uniq = exports.last = exports.flattenDeep = exports.zipObject = void 0;
28
+ exports.notEmpty = exports.castArrayOpt = exports.isNonEmptyArray = exports.readPrivateKey = exports.inflateString = exports.base64Decode = exports.isString = exports.get = exports.uniq = exports.last = exports.flattenDeep = exports.zipObject = void 0;
29
29
  /**
30
30
  * @file utility.ts
31
31
  * @author tngan
@@ -213,7 +213,7 @@ function getPublicKeyPemFromCertificate(x509Certificate) {
213
213
  }
214
214
  /**
215
215
  * @desc Read private key from pem-formatted string
216
- * @param {string | Buffer} keyString pem-formattted string
216
+ * @param {string | Buffer} keyString pem-formatted string
217
217
  * @param {string} protected passphrase of the key
218
218
  * @return {string} string in pem format
219
219
  * If passphrase is used to protect the .pem content (recommend)
@@ -235,6 +235,12 @@ function isNonEmptyArray(a) {
235
235
  return Array.isArray(a) && a.length > 0;
236
236
  }
237
237
  exports.isNonEmptyArray = isNonEmptyArray;
238
+ function castArrayOpt(a) {
239
+ if (a === undefined)
240
+ return [];
241
+ return Array.isArray(a) ? a : [a];
242
+ }
243
+ exports.castArrayOpt = castArrayOpt;
238
244
  function notEmpty(value) {
239
245
  return value !== null && value !== undefined;
240
246
  }
@@ -1 +1 @@
1
- {"version":3,"file":"utility.js","sourceRoot":"","sources":["../../src/utility.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;EAIE;AACF,yCAA6C;AAC7C,6BAAwC;AAExC,IAAM,UAAU,GAAG,QAAQ,CAAC;AA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,SAAS,CAAC;AAC/J,CAAC;AAFD,wCAEC;AACD;;EAEE;AACF,SAAS,eAAe,CAAC,KAAK,EAAE,cAAc;IAC5C,OAAO,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACzD,CAAC;AACD;;GAEG;AACH,SAAgB,eAAe,CAAC,CAAC;IAC/B,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AAC1C,CAAC;AAFD,0CAEC;AAED,SAAgB,YAAY,CAAI,CAAW;IACzC,IAAI,CAAC,KAAK,SAAS;QAAE,OAAO,EAAE,CAAA;IAC9B,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACnC,CAAC;AAHD,oCAGC;AAED,SAAgB,QAAQ,CAAS,KAAgC;IAC/D,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC/C,CAAC;AAFD,4BAEC;AAED,IAAM,OAAO,GAAG;IACd,QAAQ,UAAA;IACR,YAAY,cAAA;IACZ,YAAY,cAAA;IACZ,aAAa,eAAA;IACb,aAAa,eAAA;IACb,kBAAkB,oBAAA;IAClB,kBAAkB,oBAAA;IAClB,UAAU,YAAA;IACV,WAAW,aAAA;IACX,YAAY,cAAA;IACZ,8BAA8B,gCAAA;IAC9B,cAAc,gBAAA;IACd,eAAe,iBAAA;IACf,eAAe,iBAAA;CAChB,CAAC;AAEF,kBAAe,OAAO,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "samlify",
3
- "version": "2.8.6",
3
+ "version": "2.8.8",
4
4
  "description": "High-level API for Single Sign On (SAML 2.0)",
5
5
  "main": "build/index.js",
6
6
  "keywords": [
@@ -31,15 +31,15 @@
31
31
  },
32
32
  "license": "MIT",
33
33
  "dependencies": {
34
- "@authenio/xml-encryption": "^2.0.1",
35
- "@xmldom/xmldom": "^0.8.3",
34
+ "@authenio/xml-encryption": "^2.0.2",
35
+ "@xmldom/xmldom": "^0.8.6",
36
36
  "camelcase": "^6.2.0",
37
37
  "node-forge": "^1.3.0",
38
38
  "node-rsa": "^1.1.1",
39
39
  "pako": "^1.0.10",
40
40
  "uuid": "^8.3.2",
41
41
  "xml": "^1.0.1",
42
- "xml-crypto": "^3.0.0",
42
+ "xml-crypto": "^3.0.1",
43
43
  "xpath": "^0.0.32"
44
44
  },
45
45
  "devDependencies": {
package/src/api.ts CHANGED
@@ -16,10 +16,10 @@ export function getContext() {
16
16
  export function setSchemaValidator(params: ValidatorContext) {
17
17
 
18
18
  if (typeof params.validate !== 'function') {
19
- throw new Error('validate must be a callback function having one arguemnt as xml input');
19
+ throw new Error('validate must be a callback function having one argument as xml input');
20
20
  }
21
21
 
22
22
  // assign the validate function to the context
23
23
  context.validate = params.validate;
24
24
 
25
- }
25
+ }
@@ -8,7 +8,6 @@ import { wording, namespace, StatusCode } from './urn';
8
8
  import { BindingContext } from './entity';
9
9
  import libsaml from './libsaml';
10
10
  import utility, { get } from './utility';
11
- import { LogoutResponseTemplate } from './libsaml';
12
11
 
13
12
  const binding = wording.binding;
14
13
 
@@ -145,7 +144,7 @@ async function base64LoginResponse(requestInfo: any = {}, entity: any, user: any
145
144
  ...config,
146
145
  rawSamlMessage: rawSamlResponse,
147
146
  transformationAlgorithms: spSetting.transformationAlgorithms,
148
- referenceTagXPath: "/*[local-name(.)='Response']/*[local-name(.)='Assertion']",
147
+ referenceTagXPath: "/*[local-name(.)='Response']/*[local-name(.)='Assertion']",
149
148
  signatureConfig: {
150
149
  prefix: 'ds',
151
150
  location: { reference: "/*[local-name(.)='Response']/*[local-name(.)='Assertion']/*[local-name(.)='Issuer']", action: 'after' },
@@ -315,7 +314,7 @@ function base64LogoutResponse(requestInfo: any, entity: any, customTagReplacemen
315
314
  reference: "/*[local-name(.)='LogoutResponse']/*[local-name(.)='Issuer']",
316
315
  action: 'after'
317
316
  }
318
- }
317
+ }
319
318
  }),
320
319
  };
321
320
  }
@@ -301,7 +301,7 @@ function logoutResponseRedirectURL(requestInfo: any, entity: any, relayState?: s
301
301
  IssueInstant: new Date().toISOString(),
302
302
  StatusCode: namespace.statusCode.success,
303
303
  };
304
- if (requestInfo && requestInfo.extract && requestInfo.extract.logoutRequest) {
304
+ if (requestInfo && requestInfo.extract && requestInfo.extract.request) {
305
305
  tvalue.InResponseTo = requestInfo.extract.request.id;
306
306
  }
307
307
  rawSamlResponse = libsaml.replaceTagsByValue(libsaml.defaultLogoutResponseTemplate.context, tvalue);
@@ -39,7 +39,7 @@ function pvPair(param: string, value: string, first?: boolean): string {
39
39
  }
40
40
  /**
41
41
  * @private
42
- * @desc Refractored part of simple signature generation for login/logout request
42
+ * @desc Refactored part of simple signature generation for login/logout request
43
43
  * @param {string} type
44
44
  * @param {string} rawSamlRequest
45
45
  * @param {object} entitySetting
@@ -61,10 +61,10 @@ function buildSimpleSignature(opts: BuildSimpleSignConfig) : string {
61
61
  const sigAlg = pvPair(urlParams.sigAlg, entitySetting.requestSignatureAlgorithm);
62
62
  const octetString = context + relayState + sigAlg;
63
63
  return libsaml.constructMessageSignature(
64
- queryParam + '=' + octetString,
65
- entitySetting.privateKey,
66
- entitySetting.privateKeyPass,
67
- undefined,
64
+ queryParam + '=' + octetString,
65
+ entitySetting.privateKey,
66
+ entitySetting.privateKeyPass,
67
+ undefined,
68
68
  entitySetting.requestSignatureAlgorithm
69
69
  ).toString();
70
70
  }
package/src/entity-idp.ts CHANGED
@@ -20,14 +20,14 @@ import { isString } from './utility';
20
20
  import { BindingContext } from './entity';
21
21
 
22
22
  /**
23
- * Identity prvider can be configured using either metadata importing or idpSetting
23
+ * Identity provider can be configured using either metadata importing or idpSetting
24
24
  */
25
25
  export default function(props: IdentityProviderSettings) {
26
26
  return new IdentityProvider(props);
27
27
  }
28
28
 
29
29
  /**
30
- * Identity prvider can be configured using either metadata importing or idpSetting
30
+ * Identity provider can be configured using either metadata importing or idpSetting
31
31
  */
32
32
  export class IdentityProvider extends Entity {
33
33
 
package/src/extractor.ts CHANGED
@@ -165,6 +165,11 @@ export const logoutRequestFields: ExtractorFields = [
165
165
  localPath: ['LogoutRequest', 'NameID'],
166
166
  attributes: []
167
167
  },
168
+ {
169
+ key: 'sessionIndex',
170
+ localPath: ['LogoutRequest', 'SessionIndex'],
171
+ attributes: []
172
+ },
168
173
  {
169
174
  key: 'signature',
170
175
  localPath: ['LogoutRequest', 'Signature'],
package/src/flow.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { inflateString, base64Decode, isNonEmptyArray } from './utility';
1
+ import { inflateString, base64Decode } from './utility';
2
2
  import { verifyTime } from './validator';
3
3
  import libsaml from './libsaml';
4
4
  import {
@@ -19,7 +19,6 @@ import {
19
19
  MessageSignatureOrder,
20
20
  StatusCode
21
21
  } from './urn';
22
- import simpleSignBinding from './binding-simplesign';
23
22
 
24
23
  const bindDict = wording.binding;
25
24
  const urlParams = wording.urlParams;
@@ -110,7 +109,7 @@ async function redirectFlow(options): Promise<FlowResult> {
110
109
  return Promise.reject('ERR_MISSING_SIG_ALG');
111
110
  }
112
111
 
113
- // put the below two assignemnts into verifyMessageSignature function
112
+ // put the below two assignments into verifyMessageSignature function
114
113
  const base64Signature = Buffer.from(decodeURIComponent(signature), 'base64');
115
114
  const decodeSigAlg = decodeURIComponent(sigAlg);
116
115
 
@@ -125,7 +124,7 @@ async function redirectFlow(options): Promise<FlowResult> {
125
124
  }
126
125
 
127
126
  /**
128
- * Validation part: validate the context of response after signature is verified and decrpyted (optional)
127
+ * Validation part: validate the context of response after signature is verified and decrypted (optional)
129
128
  */
130
129
  const issuer = targetEntityMetadata.getEntityID();
131
130
  const extractedProperties = parseResult.extract;
@@ -207,7 +206,7 @@ async function postFlow(options): Promise<FlowResult> {
207
206
  // check status based on different scenarios
208
207
  await checkStatus(samlContent, parserType);
209
208
 
210
- // verify the signatures (the repsonse is encrypted then signed, then verify first then decrypt)
209
+ // verify the signatures (the response is encrypted then signed, then verify first then decrypt)
211
210
  if (
212
211
  checkSignature &&
213
212
  from.entitySetting.messageSigningOrder === MessageSignatureOrder.ETS
@@ -227,7 +226,7 @@ async function postFlow(options): Promise<FlowResult> {
227
226
  extractorFields = getDefaultExtractorFields(parserType, result[1]);
228
227
  }
229
228
 
230
- // verify the signatures (the repsonse is signed then encrypted, then decrypt first then verify)
229
+ // verify the signatures (the response is signed then encrypted, then decrypt first then verify)
231
230
  if (
232
231
  checkSignature &&
233
232
  from.entitySetting.messageSigningOrder === MessageSignatureOrder.STE
@@ -246,7 +245,7 @@ async function postFlow(options): Promise<FlowResult> {
246
245
  };
247
246
 
248
247
  /**
249
- * Validation part: validate the context of response after signature is verified and decrpyted (optional)
248
+ * Validation part: validate the context of response after signature is verified and decrypted (optional)
250
249
  */
251
250
  const targetEntityMetadata = from.entityMeta;
252
251
  const issuer = targetEntityMetadata.getEntityID();
@@ -355,7 +354,7 @@ async function postSimpleSignFlow(options): Promise<FlowResult> {
355
354
  return Promise.reject('ERR_MISSING_SIG_ALG');
356
355
  }
357
356
 
358
- // put the below two assignemnts into verifyMessageSignature function
357
+ // put the below two assignments into verifyMessageSignature function
359
358
  const base64Signature = Buffer.from(signature, 'base64');
360
359
 
361
360
  const verified = libsaml.verifyMessageSignature(targetEntityMetadata, octetString, base64Signature, sigAlg);
@@ -369,7 +368,7 @@ async function postSimpleSignFlow(options): Promise<FlowResult> {
369
368
  }
370
369
 
371
370
  /**
372
- * Validation part: validate the context of response after signature is verified and decrpyted (optional)
371
+ * Validation part: validate the context of response after signature is verified and decrypted (optional)
373
372
  */
374
373
  const issuer = targetEntityMetadata.getEntityID();
375
374
  const extractedProperties = parseResult.extract;
package/src/libsaml.ts CHANGED
@@ -175,8 +175,8 @@ const libSaml = () => {
175
175
  context: '<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="{ID}" Version="2.0" IssueInstant="{IssueInstant}" Destination="{Destination}" InResponseTo="{InResponseTo}"><saml:Issuer>{Issuer}</saml:Issuer><samlp:Status><samlp:StatusCode Value="{StatusCode}"/></samlp:Status><saml:Assertion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="{AssertionID}" Version="2.0" IssueInstant="{IssueInstant}"><saml:Issuer>{Issuer}</saml:Issuer><saml:Subject><saml:NameID Format="{NameIDFormat}">{NameID}</saml:NameID><saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"><saml:SubjectConfirmationData NotOnOrAfter="{SubjectConfirmationDataNotOnOrAfter}" Recipient="{SubjectRecipient}" InResponseTo="{InResponseTo}"/></saml:SubjectConfirmation></saml:Subject><saml:Conditions NotBefore="{ConditionsNotBefore}" NotOnOrAfter="{ConditionsNotOnOrAfter}"><saml:AudienceRestriction><saml:Audience>{Audience}</saml:Audience></saml:AudienceRestriction></saml:Conditions>{AuthnStatement}{AttributeStatement}</saml:Assertion></samlp:Response>',
176
176
  attributes: [],
177
177
  additionalTemplates: {
178
- "attributeStatementTemplate": defaultAttributeStatementTemplate,
179
- "attributeTemplate": defaultAttributeTemplate
178
+ 'attributeStatementTemplate': defaultAttributeStatementTemplate,
179
+ 'attributeTemplate': defaultAttributeTemplate
180
180
  }
181
181
  };
182
182
  /**
@@ -252,7 +252,7 @@ const libSaml = () => {
252
252
  defaultLogoutResponseTemplate,
253
253
 
254
254
  /**
255
- * @desc Repalce the tag (e.g. {tag}) inside the raw XML
255
+ * @desc Replace the tag (e.g. {tag}) inside the raw XML
256
256
  * @param {string} rawXML raw XML string used to do keyword replacement
257
257
  * @param {array} tagValues tag values
258
258
  * @return {string}
@@ -266,8 +266,8 @@ const libSaml = () => {
266
266
  /**
267
267
  * @desc Helper function to build the AttributeStatement tag
268
268
  * @param {LoginResponseAttribute} attributes an array of attribute configuration
269
- * @param {AttributeTemplate} attributeTemplate the attribut tag template to be used
270
- * @param {AttributeStatementTemplate} attributeStatementTemplate the attributStatement tag template to be used
269
+ * @param {AttributeTemplate} attributeTemplate the attribute tag template to be used
270
+ * @param {AttributeStatementTemplate} attributeStatementTemplate the attributeStatement tag template to be used
271
271
  * @return {string}
272
272
  */
273
273
  attributeStatementBuilder(
@@ -351,7 +351,6 @@ const libSaml = () => {
351
351
  /**
352
352
  * @desc Verify the XML signature
353
353
  * @param {string} xml xml
354
- * @param {signature} signature context of XML signature
355
354
  * @param {SignatureVerifierOptions} opts cert declares the X509 certificate
356
355
  * @return {boolean} verification result
357
356
  */
@@ -639,7 +638,7 @@ const libSaml = () => {
639
638
  return resolve(utility.base64Encode(doc.toString()));
640
639
  });
641
640
  } else {
642
- return resolve(utility.base64Encode(xml)); // No need to do encrpytion
641
+ return resolve(utility.base64Encode(xml)); // No need to do encryption
643
642
  }
644
643
  });
645
644
  },
@@ -7,7 +7,7 @@ import Metadata, { MetadataInterface } from './metadata';
7
7
  import { MetadataIdpOptions, MetadataIdpConstructor } from './types';
8
8
  import { namespace } from './urn';
9
9
  import libsaml from './libsaml';
10
- import { isNonEmptyArray, isString } from './utility';
10
+ import { castArrayOpt, isNonEmptyArray, isString } from './utility';
11
11
  import xml from 'xml';
12
12
 
13
13
  export interface IdpMetadataInterface extends MetadataInterface {
@@ -46,16 +46,12 @@ export class IdpMetadata extends Metadata {
46
46
  },
47
47
  }];
48
48
 
49
- if (signingCert) {
50
- IDPSSODescriptor.push(libsaml.createKeySection('signing', signingCert));
51
- } else {
52
- //console.warn('Construct identity provider - missing signing certificate');
49
+ for(const cert of castArrayOpt(signingCert)) {
50
+ IDPSSODescriptor.push(libsaml.createKeySection('signing', cert));
53
51
  }
54
52
 
55
- if (encryptCert) {
56
- IDPSSODescriptor.push(libsaml.createKeySection('encryption', encryptCert));
57
- } else {
58
- //console.warn('Construct identity provider - missing encrypt certificate');
53
+ for(const cert of castArrayOpt(encryptCert)) {
54
+ IDPSSODescriptor.push(libsaml.createKeySection('encryption', cert));
59
55
  }
60
56
 
61
57
  if (isNonEmptyArray(nameIDFormat)) {
@@ -7,7 +7,7 @@ import Metadata, { MetadataInterface } from './metadata';
7
7
  import { MetadataSpConstructor, MetadataSpOptions } from './types';
8
8
  import { namespace, elementsOrder as order } from './urn';
9
9
  import libsaml from './libsaml';
10
- import { isNonEmptyArray, isString } from './utility';
10
+ import { castArrayOpt, isNonEmptyArray, isString } from './utility';
11
11
  import xml from 'xml';
12
12
 
13
13
  export interface SpMetadataInterface extends MetadataInterface {
@@ -36,14 +36,14 @@ export default function(meta: MetadataSpConstructor) {
36
36
  export class SpMetadata extends Metadata {
37
37
 
38
38
  /**
39
- * @param {object/string} meta (either xml string or configuation in object)
39
+ * @param {object/string} meta (either xml string or configuration in object)
40
40
  * @return {object} prototypes including public functions
41
41
  */
42
42
  constructor(meta: MetadataSpConstructor) {
43
43
 
44
44
  const isFile = isString(meta) || meta instanceof Buffer;
45
45
 
46
- // use object configuation instead of importing metadata file directly
46
+ // use object configuration instead of importing metadata file directly
47
47
  if (!isFile) {
48
48
 
49
49
  const {
@@ -80,16 +80,12 @@ export class SpMetadata extends Metadata {
80
80
  console.warn('Construct service provider - missing signatureConfig');
81
81
  }
82
82
 
83
- if (signingCert) {
84
- descriptors.KeyDescriptor!.push(libsaml.createKeySection('signing', signingCert).KeyDescriptor);
85
- } else {
86
- //console.warn('Construct service provider - missing signing certificate');
83
+ for(const cert of castArrayOpt(signingCert)) {
84
+ descriptors.KeyDescriptor!.push(libsaml.createKeySection('signing', cert).KeyDescriptor);
87
85
  }
88
86
 
89
- if (encryptCert) {
90
- descriptors.KeyDescriptor!.push(libsaml.createKeySection('encryption', encryptCert).KeyDescriptor);
91
- } else {
92
- //console.warn('Construct service provider - missing encrypt certificate');
87
+ for(const cert of castArrayOpt(encryptCert)) {
88
+ descriptors.KeyDescriptor!.push(libsaml.createKeySection('encryption', cert).KeyDescriptor);
93
89
  }
94
90
 
95
91
  if (isNonEmptyArray(nameIDFormat)) {
package/src/metadata.ts CHANGED
@@ -25,7 +25,7 @@ export default class Metadata implements MetadataInterface {
25
25
  meta: any;
26
26
 
27
27
  /**
28
- * @param {string | Buffer} metadata xml
28
+ * @param {string | Buffer} xml
29
29
  * @param {object} extraParse for custom metadata extractor
30
30
  */
31
31
  constructor(xml: string | Buffer, extraParse: any = []) {
@@ -140,7 +140,7 @@ export default class Metadata implements MetadataInterface {
140
140
  if (!(singleLogoutService instanceof Array)) {
141
141
  singleLogoutService = [singleLogoutService];
142
142
  }
143
- const service = singleLogoutService.find(obj => obj.binding === bindType);
143
+ const service = singleLogoutService.find(obj => obj.binding === bindType);
144
144
  if (service) {
145
145
  return service.location;
146
146
  }
package/src/types.ts CHANGED
@@ -16,8 +16,8 @@ type SSOService = {
16
16
 
17
17
  export interface MetadataIdpOptions {
18
18
  entityID?: string;
19
- signingCert?: string | Buffer;
20
- encryptCert?: string | Buffer;
19
+ signingCert?: string | Buffer | (string | Buffer)[];
20
+ encryptCert?: string | Buffer | (string | Buffer)[];
21
21
  wantAuthnRequestsSigned?: boolean;
22
22
  nameIDFormat?: string[];
23
23
  singleSignOnService?: SSOService[];
@@ -31,8 +31,8 @@ export type MetadataIdpConstructor =
31
31
 
32
32
  export interface MetadataSpOptions {
33
33
  entityID?: string;
34
- signingCert?: string | Buffer;
35
- encryptCert?: string | Buffer;
34
+ signingCert?: string | Buffer | (string | Buffer)[];
35
+ encryptCert?: string | Buffer | (string | Buffer)[];
36
36
  authnRequestsSigned?: boolean;
37
37
  wantAssertionsSigned?: boolean;
38
38
  wantMessageSigned?: boolean;
@@ -81,8 +81,8 @@ export type ServiceProviderSettings = {
81
81
  signatureConfig?: SignatureConfig;
82
82
  loginRequestTemplate?: SAMLDocumentTemplate;
83
83
  logoutRequestTemplate?: SAMLDocumentTemplate;
84
- signingCert?: string | Buffer;
85
- encryptCert?: string | Buffer;
84
+ signingCert?: string | Buffer | (string | Buffer)[];
85
+ encryptCert?: string | Buffer | (string | Buffer)[];
86
86
  transformationAlgorithms?: string[];
87
87
  nameIDFormat?: string[];
88
88
  allowCreate?: boolean;
@@ -110,8 +110,8 @@ export type IdentityProviderSettings = {
110
110
  entityID?: string;
111
111
  privateKey?: string | Buffer;
112
112
  privateKeyPass?: string;
113
- signingCert?: string | Buffer;
114
- encryptCert?: string | Buffer; /** todo */
113
+ signingCert?: string | Buffer | (string | Buffer)[];
114
+ encryptCert?: string | Buffer | (string | Buffer)[];
115
115
  nameIDFormat?: string[];
116
116
  singleSignOnService?: SSOService[];
117
117
  singleLogoutService?: SSOService[];
package/src/utility.ts CHANGED
@@ -15,7 +15,7 @@ const BASE64_STR = 'base64';
15
15
  */
16
16
  export function zipObject(arr1: string[], arr2: any[], skipDuplicated = true) {
17
17
  return arr1.reduce((res, l, i) => {
18
-
18
+
19
19
  if (skipDuplicated) {
20
20
  res[l] = arr2[i];
21
21
  return res;
@@ -61,19 +61,19 @@ export function uniq(input: string[]) {
61
61
  return [... set];
62
62
  }
63
63
  /**
64
- * @desc Alternative to lodash.get
64
+ * @desc Alternative to lodash.get
65
65
  * @reference https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_get
66
- * @param obj
67
- * @param path
68
- * @param defaultValue
66
+ * @param obj
67
+ * @param path
68
+ * @param defaultValue
69
69
  */
70
70
  export function get(obj, path, defaultValue) {
71
71
  return path.split('.')
72
72
  .reduce((a, c) => (a && a[c] ? a[c] : (defaultValue || null)), obj);
73
73
  }
74
74
  /**
75
- * @desc Check if the input is string
76
- * @param {any} input
75
+ * @desc Check if the input is string
76
+ * @param {any} input
77
77
  */
78
78
  export function isString(input: any) {
79
79
  return typeof input === 'string';
@@ -180,7 +180,7 @@ function getPublicKeyPemFromCertificate(x509Certificate: string) {
180
180
  }
181
181
  /**
182
182
  * @desc Read private key from pem-formatted string
183
- * @param {string | Buffer} keyString pem-formattted string
183
+ * @param {string | Buffer} keyString pem-formatted string
184
184
  * @param {string} protected passphrase of the key
185
185
  * @return {string} string in pem format
186
186
  * If passphrase is used to protect the .pem content (recommend)
@@ -201,6 +201,11 @@ export function isNonEmptyArray(a) {
201
201
  return Array.isArray(a) && a.length > 0;
202
202
  }
203
203
 
204
+ export function castArrayOpt<T>(a?: T | T[]): T[] {
205
+ if (a === undefined) return []
206
+ return Array.isArray(a) ? a : [a]
207
+ }
208
+
204
209
  export function notEmpty<TValue>(value: TValue | null | undefined): value is TValue {
205
210
  return value !== null && value !== undefined;
206
211
  }
@@ -8,11 +8,11 @@ import { ServiceProviderConstructor as ServiceProvider, IdentityProviderMetadata
8
8
  import { FlowResult } from './flow';
9
9
  import { BindingContext } from './entity';
10
10
  /**
11
- * Identity prvider can be configured using either metadata importing or idpSetting
11
+ * Identity provider can be configured using either metadata importing or idpSetting
12
12
  */
13
13
  export default function (props: IdentityProviderSettings): IdentityProvider;
14
14
  /**
15
- * Identity prvider can be configured using either metadata importing or idpSetting
15
+ * Identity provider can be configured using either metadata importing or idpSetting
16
16
  */
17
17
  export declare class IdentityProvider extends Entity {
18
18
  entityMeta: IdentityProviderMetadata;
@@ -116,7 +116,7 @@ declare const _default: {
116
116
  context: string;
117
117
  };
118
118
  /**
119
- * @desc Repalce the tag (e.g. {tag}) inside the raw XML
119
+ * @desc Replace the tag (e.g. {tag}) inside the raw XML
120
120
  * @param {string} rawXML raw XML string used to do keyword replacement
121
121
  * @param {array} tagValues tag values
122
122
  * @return {string}
@@ -125,8 +125,8 @@ declare const _default: {
125
125
  /**
126
126
  * @desc Helper function to build the AttributeStatement tag
127
127
  * @param {LoginResponseAttribute} attributes an array of attribute configuration
128
- * @param {AttributeTemplate} attributeTemplate the attribut tag template to be used
129
- * @param {AttributeStatementTemplate} attributeStatementTemplate the attributStatement tag template to be used
128
+ * @param {AttributeTemplate} attributeTemplate the attribute tag template to be used
129
+ * @param {AttributeStatementTemplate} attributeStatementTemplate the attributeStatement tag template to be used
130
130
  * @return {string}
131
131
  */
132
132
  attributeStatementBuilder(attributes: LoginResponseAttribute[], attributeTemplate?: AttributeTemplate, attributeStatementTemplate?: AttributeStatementTemplate): string;
@@ -145,7 +145,6 @@ declare const _default: {
145
145
  /**
146
146
  * @desc Verify the XML signature
147
147
  * @param {string} xml xml
148
- * @param {signature} signature context of XML signature
149
148
  * @param {SignatureVerifierOptions} opts cert declares the X509 certificate
150
149
  * @return {boolean} verification result
151
150
  */
@@ -13,7 +13,7 @@ export default function (meta: MetadataSpConstructor): SpMetadata;
13
13
  */
14
14
  export declare class SpMetadata extends Metadata {
15
15
  /**
16
- * @param {object/string} meta (either xml string or configuation in object)
16
+ * @param {object/string} meta (either xml string or configuration in object)
17
17
  * @return {object} prototypes including public functions
18
18
  */
19
19
  constructor(meta: MetadataSpConstructor);
@@ -13,7 +13,7 @@ export default class Metadata implements MetadataInterface {
13
13
  xmlString: string;
14
14
  meta: any;
15
15
  /**
16
- * @param {string | Buffer} metadata xml
16
+ * @param {string | Buffer} xml
17
17
  * @param {object} extraParse for custom metadata extractor
18
18
  */
19
19
  constructor(xml: string | Buffer, extraParse?: any);
@@ -12,8 +12,8 @@ declare type SSOService = {
12
12
  };
13
13
  export interface MetadataIdpOptions {
14
14
  entityID?: string;
15
- signingCert?: string | Buffer;
16
- encryptCert?: string | Buffer;
15
+ signingCert?: string | Buffer | (string | Buffer)[];
16
+ encryptCert?: string | Buffer | (string | Buffer)[];
17
17
  wantAuthnRequestsSigned?: boolean;
18
18
  nameIDFormat?: string[];
19
19
  singleSignOnService?: SSOService[];
@@ -23,8 +23,8 @@ export interface MetadataIdpOptions {
23
23
  export declare type MetadataIdpConstructor = MetadataIdpOptions | MetadataFile;
24
24
  export interface MetadataSpOptions {
25
25
  entityID?: string;
26
- signingCert?: string | Buffer;
27
- encryptCert?: string | Buffer;
26
+ signingCert?: string | Buffer | (string | Buffer)[];
27
+ encryptCert?: string | Buffer | (string | Buffer)[];
28
28
  authnRequestsSigned?: boolean;
29
29
  wantAssertionsSigned?: boolean;
30
30
  wantMessageSigned?: boolean;
@@ -68,8 +68,8 @@ export declare type ServiceProviderSettings = {
68
68
  signatureConfig?: SignatureConfig;
69
69
  loginRequestTemplate?: SAMLDocumentTemplate;
70
70
  logoutRequestTemplate?: SAMLDocumentTemplate;
71
- signingCert?: string | Buffer;
72
- encryptCert?: string | Buffer;
71
+ signingCert?: string | Buffer | (string | Buffer)[];
72
+ encryptCert?: string | Buffer | (string | Buffer)[];
73
73
  transformationAlgorithms?: string[];
74
74
  nameIDFormat?: string[];
75
75
  allowCreate?: boolean;
@@ -89,8 +89,8 @@ export declare type IdentityProviderSettings = {
89
89
  entityID?: string;
90
90
  privateKey?: string | Buffer;
91
91
  privateKeyPass?: string;
92
- signingCert?: string | Buffer;
93
- encryptCert?: string | Buffer; /** todo */
92
+ signingCert?: string | Buffer | (string | Buffer)[];
93
+ encryptCert?: string | Buffer | (string | Buffer)[];
94
94
  nameIDFormat?: string[];
95
95
  singleSignOnService?: SSOService[];
96
96
  singleLogoutService?: SSOService[];
@@ -100,7 +100,7 @@ declare function applyDefault(obj1: any, obj2: any): any;
100
100
  declare function getPublicKeyPemFromCertificate(x509Certificate: string): string;
101
101
  /**
102
102
  * @desc Read private key from pem-formatted string
103
- * @param {string | Buffer} keyString pem-formattted string
103
+ * @param {string | Buffer} keyString pem-formatted string
104
104
  * @param {string} protected passphrase of the key
105
105
  * @return {string} string in pem format
106
106
  * If passphrase is used to protect the .pem content (recommend)
@@ -114,6 +114,7 @@ declare function convertToString(input: any, isOutputString: any): any;
114
114
  * @desc Check if the input is an array with non-zero size
115
115
  */
116
116
  export declare function isNonEmptyArray(a: any): boolean;
117
+ export declare function castArrayOpt<T>(a?: T | T[]): T[];
117
118
  export declare function notEmpty<TValue>(value: TValue | null | undefined): value is TValue;
118
119
  declare const utility: {
119
120
  isString: typeof isString;