samlesa 2.17.1 → 2.17.2

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.
Files changed (46) hide show
  1. package/build/index.js +2 -2
  2. package/build/src/binding-post.js +2 -0
  3. package/build/src/metadata-idp.js +9 -9
  4. package/build/src/metadata-sp.js +6 -6
  5. package/build/src/schema/saml-schema-metadata-2.0.xsd +10 -9
  6. package/build/src/schemaValidator.js +43 -0
  7. package/package.json +78 -77
  8. package/types/index.d.ts +2 -2
  9. package/types/index.d.ts.map +1 -1
  10. package/types/src/binding-post.d.ts.map +1 -1
  11. package/types/src/schemaValidator.d.ts +1 -0
  12. package/types/src/schemaValidator.d.ts.map +1 -1
  13. package/types/api.d.ts +0 -15
  14. package/types/api.d.ts.map +0 -1
  15. package/types/binding-post.d.ts +0 -48
  16. package/types/binding-post.d.ts.map +0 -1
  17. package/types/binding-redirect.d.ts +0 -54
  18. package/types/binding-redirect.d.ts.map +0 -1
  19. package/types/binding-simplesign.d.ts +0 -41
  20. package/types/binding-simplesign.d.ts.map +0 -1
  21. package/types/entity-idp.d.ts +0 -38
  22. package/types/entity-idp.d.ts.map +0 -1
  23. package/types/entity-sp.d.ts +0 -38
  24. package/types/entity-sp.d.ts.map +0 -1
  25. package/types/entity.d.ts +0 -100
  26. package/types/entity.d.ts.map +0 -1
  27. package/types/extractor.d.ts +0 -26
  28. package/types/extractor.d.ts.map +0 -1
  29. package/types/flow.d.ts +0 -7
  30. package/types/flow.d.ts.map +0 -1
  31. package/types/libsaml.d.ts +0 -208
  32. package/types/libsaml.d.ts.map +0 -1
  33. package/types/metadata-idp.d.ts +0 -25
  34. package/types/metadata-idp.d.ts.map +0 -1
  35. package/types/metadata-sp.d.ts +0 -37
  36. package/types/metadata-sp.d.ts.map +0 -1
  37. package/types/metadata.d.ts +0 -58
  38. package/types/metadata.d.ts.map +0 -1
  39. package/types/types.d.ts +0 -128
  40. package/types/types.d.ts.map +0 -1
  41. package/types/urn.d.ts +0 -195
  42. package/types/urn.d.ts.map +0 -1
  43. package/types/utility.d.ts +0 -133
  44. package/types/utility.d.ts.map +0 -1
  45. package/types/validator.d.ts +0 -4
  46. package/types/validator.d.ts.map +0 -1
package/build/index.js CHANGED
@@ -10,11 +10,11 @@ export { default as SamlLib } from './src/libsaml.js';
10
10
  import * as Constants from './src/urn.js';
11
11
  import * as Extractor from './src/extractor.js';
12
12
  import * as Soap from './src/soap.js';
13
- import { validate } from './src/schemaValidator.js';
13
+ import { validate, validateMetadata } from './src/schemaValidator.js';
14
14
  // exposed methods for customizing samlify
15
15
  import { setSchemaValidator, setDOMParserOptions } from './src/api.js';
16
16
  export { Constants, Extractor,
17
17
  // temp: resolve the conflict after version >= 3.0
18
18
  IdentityProvider, IdentityProviderInstance, ServiceProvider, ServiceProviderInstance,
19
19
  // set context
20
- setSchemaValidator, setDOMParserOptions, validate, Soap };
20
+ setSchemaValidator, setDOMParserOptions, validate, validateMetadata, Soap };
@@ -130,6 +130,8 @@ async function base64LoginResponse(requestInfo = {}, entity, user = {}, customTa
130
130
  tvalue.InResponseTo = requestInfo?.extract?.request?.id ?? '';
131
131
  }
132
132
  rawSamlResponse = libsaml.replaceTagsByValue(libsaml.defaultLoginResponseTemplate.context, tvalue);
133
+ console.log(rawSamlResponse);
134
+ console.log("没有加密签名过的------------------------------------");
133
135
  }
134
136
  const { privateKey, privateKeyPass, requestSignatureAlgorithm: signatureAlgorithm } = idpSetting;
135
137
  const config = {
@@ -40,9 +40,9 @@ export class IdpMetadata extends Metadata {
40
40
  Binding: a.Binding,
41
41
  Location: a.Location,
42
42
  };
43
- if (a.isDefault) {
44
- attr.isDefault = true;
45
- }
43
+ /* if (a.isDefault) {
44
+ attr.isDefault = true;
45
+ }*/
46
46
  IDPSSODescriptor.push({ SingleSignOnService: [{ _attr: attr }] });
47
47
  });
48
48
  }
@@ -52,9 +52,9 @@ export class IdpMetadata extends Metadata {
52
52
  if (isNonEmptyArray(singleLogoutService)) {
53
53
  singleLogoutService.forEach((a, indexCount) => {
54
54
  const attr = {};
55
- if (a.isDefault) {
56
- attr.isDefault = true;
57
- }
55
+ /* if (a.isDefault) {
56
+ attr.isDefault = true;
57
+ }*/
58
58
  attr.Binding = a.Binding;
59
59
  attr.Location = a.Location;
60
60
  IDPSSODescriptor.push({ SingleLogoutService: [{ _attr: attr }] });
@@ -66,9 +66,9 @@ export class IdpMetadata extends Metadata {
66
66
  if (isNonEmptyArray(artifactResolutionService)) {
67
67
  artifactResolutionService.forEach((a, indexCount) => {
68
68
  const attr = {};
69
- if (a.isDefault) {
70
- attr.isDefault = true;
71
- }
69
+ /* if (a.isDefault) {
70
+ attr.isDefault = true;
71
+ }*/
72
72
  attr.Binding = a.Binding;
73
73
  attr.Location = a.Location;
74
74
  IDPSSODescriptor.push({ ArtifactResolutionService: [{ _attr: attr }] });
@@ -64,9 +64,9 @@ export class SpMetadata extends Metadata {
64
64
  Binding: a.Binding,
65
65
  Location: a.Location,
66
66
  };
67
- if (a.isDefault) {
68
- attr.isDefault = true;
69
- }
67
+ /* if (a.isDefault) {
68
+ attr.isDefault = true;
69
+ }*/
70
70
  descriptors.SingleLogoutService.push([{ _attr: attr }]);
71
71
  });
72
72
  }
@@ -78,9 +78,9 @@ export class SpMetadata extends Metadata {
78
78
  Binding: a.Binding,
79
79
  Location: a.Location,
80
80
  };
81
- if (a.isDefault) {
82
- attr.isDefault = true;
83
- }
81
+ /* if (a.isDefault) {
82
+ attr.isDefault = true;
83
+ }*/
84
84
  descriptors.ArtifactResolutionService.push([{ _attr: attr }]);
85
85
  });
86
86
  }
@@ -18,6 +18,7 @@
18
18
  schemaLocation="saml-schema-assertion-2.0.xsd"/>
19
19
  <import namespace="http://www.w3.org/XML/1998/namespace"
20
20
  schemaLocation="xml.xsd"/>
21
+
21
22
  <annotation>
22
23
  <documentation>
23
24
  Document identifier: saml-schema-metadata-2.0
@@ -47,14 +48,14 @@
47
48
  </extension>
48
49
  </simpleContent>
49
50
  </complexType>
50
-
51
+
51
52
  <element name="Extensions" type="md:ExtensionsType"/>
52
53
  <complexType final="#all" name="ExtensionsType">
53
54
  <sequence>
54
55
  <any namespace="##other" processContents="lax" maxOccurs="unbounded"/>
55
56
  </sequence>
56
57
  </complexType>
57
-
58
+
58
59
  <complexType name="EndpointType">
59
60
  <sequence>
60
61
  <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
@@ -64,7 +65,7 @@
64
65
  <attribute name="ResponseLocation" type="anyURI" use="optional"/>
65
66
  <anyAttribute namespace="##other" processContents="lax"/>
66
67
  </complexType>
67
-
68
+
68
69
  <complexType name="IndexedEndpointType">
69
70
  <complexContent>
70
71
  <extension base="md:EndpointType">
@@ -73,7 +74,7 @@
73
74
  </extension>
74
75
  </complexContent>
75
76
  </complexType>
76
-
77
+
77
78
  <element name="EntitiesDescriptor" type="md:EntitiesDescriptorType"/>
78
79
  <complexType name="EntitiesDescriptorType">
79
80
  <sequence>
@@ -116,7 +117,7 @@
116
117
  <attribute name="ID" type="ID" use="optional"/>
117
118
  <anyAttribute namespace="##other" processContents="lax"/>
118
119
  </complexType>
119
-
120
+
120
121
  <element name="Organization" type="md:OrganizationType"/>
121
122
  <complexType name="OrganizationType">
122
123
  <sequence>
@@ -202,7 +203,7 @@
202
203
  </restriction>
203
204
  </simpleType>
204
205
  <element name="EncryptionMethod" type="xenc:EncryptionMethodType"/>
205
-
206
+
206
207
  <complexType name="SSODescriptorType" abstract="true">
207
208
  <complexContent>
208
209
  <extension base="md:RoleDescriptorType">
@@ -239,7 +240,7 @@
239
240
  <element name="NameIDMappingService" type="md:EndpointType"/>
240
241
  <element name="AssertionIDRequestService" type="md:EndpointType"/>
241
242
  <element name="AttributeProfile" type="anyURI"/>
242
-
243
+
243
244
  <element name="SPSSODescriptor" type="md:SPSSODescriptorType"/>
244
245
  <complexType name="SPSSODescriptorType">
245
246
  <complexContent>
@@ -274,7 +275,7 @@
274
275
  </extension>
275
276
  </complexContent>
276
277
  </complexType>
277
-
278
+
278
279
  <element name="AuthnAuthorityDescriptor" type="md:AuthnAuthorityDescriptorType"/>
279
280
  <complexType name="AuthnAuthorityDescriptorType">
280
281
  <complexContent>
@@ -318,7 +319,7 @@
318
319
  </complexContent>
319
320
  </complexType>
320
321
  <element name="AttributeService" type="md:EndpointType"/>
321
-
322
+
322
323
  <element name="AffiliationDescriptor" type="md:AffiliationDescriptorType"/>
323
324
  <complexType name="AffiliationDescriptorType">
324
325
  <sequence>
@@ -30,6 +30,13 @@ let soapSchema = [
30
30
  'saml-schema-ecp-2.0.xsd', // ECP扩展
31
31
  'saml-schema-dce-2.0.xsd' // DCE扩展
32
32
  ];
33
+ let meta = [
34
+ 'saml-schema-metadata-2.0.xsd', // 元数据
35
+ 'xml.xsd',
36
+ 'saml-schema-assertion-2.0.xsd',
37
+ 'xmldsig-core-schema.xsd',
38
+ 'xenc-schema.xsd',
39
+ ];
33
40
  let schemas = normal;
34
41
  function detectXXEIndicators(samlString) {
35
42
  const xxePatterns = [
@@ -82,6 +89,42 @@ export const validate = async (xml, isSoap = false) => {
82
89
  throw validationResult.errors;
83
90
  }
84
91
  catch (error) {
92
+ console.log(error);
93
+ console.log("真的错误了=================");
94
+ throw new Error('ERR_EXCEPTION_VALIDATE_XML');
95
+ }
96
+ };
97
+ export const validateMetadata = async (xml, isSoap = false) => {
98
+ const indicators = detectXXEIndicators(xml);
99
+ if (indicators) {
100
+ throw new Error('ERR_EXCEPTION_VALIDATE_XML');
101
+ }
102
+ schemas = meta;
103
+ const schemaPath = path.resolve(__dirname, 'schema');
104
+ const [xmlParse, ...preload] = await Promise.all(schemas.map(async (file) => ({
105
+ fileName: file,
106
+ contents: await fs.promises.readFile(`${schemaPath}/${file}`, 'utf-8')
107
+ })));
108
+ try {
109
+ const validationResult = await validateXML({
110
+ xml: [
111
+ {
112
+ fileName: 'content.xml',
113
+ contents: xml,
114
+ },
115
+ ],
116
+ extension: 'schema',
117
+ schema: [xmlParse],
118
+ preload: [xmlParse, ...preload],
119
+ });
120
+ if (validationResult.valid) {
121
+ return true;
122
+ }
123
+ throw validationResult.errors;
124
+ }
125
+ catch (error) {
126
+ console.log(error);
127
+ console.log("真的错误了=================");
85
128
  throw new Error('ERR_EXCEPTION_VALIDATE_XML');
86
129
  }
87
130
  };
package/package.json CHANGED
@@ -1,77 +1,78 @@
1
- {
2
- "name": "samlesa",
3
- "version": "2.17.1",
4
- "description": "High-level API for Single Sign On (SAML 2.0) baseed on samlify ",
5
- "main": "build/index.js",
6
- "keywords": [
7
- "nodejs",
8
- "saml2",
9
- "sso",
10
- "slo",
11
- "metadata"
12
- ],
13
- "type": "module",
14
- "typings": "types/index.d.ts",
15
- "scripts": {
16
- "build": "tsc && copyfiles -u 1 src/schema/**/* build/src",
17
- "docs": "docsify serve -o docs",
18
- "lint": "tslint -p .",
19
- "lint:fix": "tslint -p . --fix",
20
- "test": "vitest",
21
- "test:watch": "vitest --watch",
22
- "test:coverage": "vitest run --coverage",
23
- "hooks:postinstall": "mklink /J .git\\hooks\\pre-commit .pre-commit.sh || copy .pre-commit.sh .git\\hooks\\pre-commit"
24
- },
25
- "exports": {
26
- ".": {
27
- "types": "./types/index.d.ts",
28
- "import": "./build/index.js"
29
- }
30
- },
31
- "files": [
32
- "build",
33
- "types"
34
- ],
35
- "contributors": [
36
- "Veclea <vemocle@gmail.com>"
37
- ],
38
- "author": "Veclea",
39
- "repository": {
40
- "url": "https://github.com/Veclea/samlify.git",
41
- "type": "git"
42
- },
43
- "license": "MIT",
44
- "dependencies": {
45
- "@xmldom/xmldom": "^0.9.8",
46
- "axios": "^1.10.0",
47
- "camelcase": "^8.0.0",
48
- "cross-env": "^7.0.3",
49
- "iconv-lite": "^0.6.3",
50
- "node-rsa": "^1.1.1",
51
- "pako": "^2.1.0",
52
- "ts-node": "^10.9.2",
53
- "uuid": "^11.1.0",
54
- "vite-tsconfig-paths": "^5.1.4",
55
- "xml": "^1.0.1",
56
- "xml-crypto": "^6.1.2",
57
- "xml-encryption": "^3.1.0",
58
- "xml-escape": "^1.1.0",
59
- "xml2js": "^0.6.2",
60
- "xmllint-wasm": "^5.0.0",
61
- "xpath": "^0.0.32"
62
- },
63
- "devDependencies": {
64
- "@types/node": "^24.0.13",
65
- "@types/pako": "2.0.3",
66
- "@types/uuid": "10.0.0",
67
- "@vitest/coverage-istanbul": "^3.2.4",
68
- "@vitest/coverage-v8": "3.2.4",
69
- "copyfiles": "^2.4.1",
70
- "coveralls": "^3.1.1",
71
- "esbuild": "^0.25.6",
72
- "jsdom": "^26.1.0",
73
- "timekeeper": "^2.3.1",
74
- "typescript": "5.8.3",
75
- "vitest": "^3.2.4"
76
- }
77
- }
1
+ {
2
+ "name": "samlesa",
3
+ "version": "2.17.2",
4
+
5
+ "description": "High-level API for Single Sign On (SAML 2.0) baseed on samlify ",
6
+ "main": "build/index.js",
7
+ "keywords": [
8
+ "nodejs",
9
+ "saml2",
10
+ "sso",
11
+ "slo",
12
+ "metadata"
13
+ ],
14
+ "type": "module",
15
+ "typings": "types/index.d.ts",
16
+ "scripts": {
17
+ "build": "tsc && copyfiles -u 1 src/schema/**/* build/src",
18
+ "docs": "docsify serve -o docs",
19
+ "lint": "tslint -p .",
20
+ "lint:fix": "tslint -p . --fix",
21
+ "test": "vitest",
22
+ "test:watch": "vitest --watch",
23
+ "test:coverage": "vitest run --coverage",
24
+ "hooks:postinstall": "mklink /J .git\\hooks\\pre-commit .pre-commit.sh || copy .pre-commit.sh .git\\hooks\\pre-commit"
25
+ },
26
+ "exports": {
27
+ ".": {
28
+ "types": "./types/index.d.ts",
29
+ "import": "./build/index.js"
30
+ }
31
+ },
32
+ "files": [
33
+ "build",
34
+ "types"
35
+ ],
36
+ "contributors": [
37
+ "Veclea <vemocle@gmail.com>"
38
+ ],
39
+ "author": "Veclea",
40
+ "repository": {
41
+ "url": "https://github.com/Veclea/samlify.git",
42
+ "type": "git"
43
+ },
44
+ "license": "MIT",
45
+ "dependencies": {
46
+ "@xmldom/xmldom": "^0.9.8",
47
+ "axios": "^1.10.0",
48
+ "camelcase": "^8.0.0",
49
+ "cross-env": "^7.0.3",
50
+ "iconv-lite": "^0.6.3",
51
+ "node-rsa": "^1.1.1",
52
+ "pako": "^2.1.0",
53
+ "ts-node": "^10.9.2",
54
+ "uuid": "^11.1.0",
55
+ "vite-tsconfig-paths": "^5.1.4",
56
+ "xml": "^1.0.1",
57
+ "xml-crypto": "^6.1.2",
58
+ "xml-encryption": "^3.1.0",
59
+ "xml-escape": "^1.1.0",
60
+ "xml2js": "^0.6.2",
61
+ "xmllint-wasm": "^5.0.0",
62
+ "xpath": "^0.0.32"
63
+ },
64
+ "devDependencies": {
65
+ "@types/node": "^24.0.13",
66
+ "@types/pako": "2.0.3",
67
+ "@types/uuid": "10.0.0",
68
+ "@vitest/coverage-istanbul": "^3.2.4",
69
+ "@vitest/coverage-v8": "3.2.4",
70
+ "copyfiles": "^2.4.1",
71
+ "coveralls": "^3.1.1",
72
+ "esbuild": "^0.25.6",
73
+ "jsdom": "^26.1.0",
74
+ "timekeeper": "^2.3.1",
75
+ "typescript": "5.8.3",
76
+ "vitest": "^3.2.4"
77
+ }
78
+ }
package/types/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export { default as SamlLib } from './src/libsaml.js';
7
7
  import * as Constants from './src/urn.js';
8
8
  import * as Extractor from './src/extractor.js';
9
9
  import * as Soap from './src/soap.js';
10
- import { validate } from './src/schemaValidator.js';
10
+ import { validate, validateMetadata } from './src/schemaValidator.js';
11
11
  import { setSchemaValidator, setDOMParserOptions } from './src/api.js';
12
- export { Constants, Extractor, IdentityProvider, IdentityProviderInstance, ServiceProvider, ServiceProviderInstance, setSchemaValidator, setDOMParserOptions, validate, Soap };
12
+ export { Constants, Extractor, IdentityProvider, IdentityProviderInstance, ServiceProvider, ServiceProviderInstance, setSchemaValidator, setDOMParserOptions, validate, validateMetadata, Soap };
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","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AAoB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,cAAc,GAAG,cAAc,CA2DvI;AAED,QAAA,MAAM,WAAW;;;;;CAKhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export declare const validate: (xml: string, isSoap?: boolean) => Promise<boolean>;
2
+ export declare const validateMetadata: (xml: string, isSoap?: boolean) => Promise<boolean>;
2
3
  //# sourceMappingURL=schemaValidator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemaValidator.d.ts","sourceRoot":"","sources":["../../src/schemaValidator.ts"],"names":[],"mappings":"AAoEA,eAAO,MAAM,QAAQ,GAAU,KAAK,MAAM,EAAC,SAAQ,OAAe,qBAmCjE,CAAC"}
1
+ {"version":3,"file":"schemaValidator.d.ts","sourceRoot":"","sources":["../../src/schemaValidator.ts"],"names":[],"mappings":"AA6EA,eAAO,MAAM,QAAQ,GAAU,KAAK,MAAM,EAAC,SAAQ,OAAe,qBAqCjE,CAAC;AACF,eAAO,MAAM,gBAAgB,GAAU,KAAK,MAAM,EAAC,SAAQ,OAAe,qBAqCzE,CAAC"}
package/types/api.d.ts DELETED
@@ -1,15 +0,0 @@
1
- import { DOMParser as dom } from '@xmldom/xmldom';
2
- import type { Options as DOMParserOptions } from '@xmldom/xmldom';
3
- interface Context extends ValidatorContext, DOMParserContext {
4
- }
5
- interface ValidatorContext {
6
- validate?: (xml: string) => Promise<any>;
7
- }
8
- interface DOMParserContext {
9
- dom: dom;
10
- }
11
- export declare function getContext(): Context;
12
- export declare function setSchemaValidator(params: ValidatorContext): void;
13
- export declare function setDOMParserOptions(options?: DOMParserOptions): void;
14
- export {};
15
- //# sourceMappingURL=api.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElE,UAAU,OAAQ,SAAQ,gBAAgB,EAAE,gBAAgB;CAAG;AAE/D,UAAU,gBAAgB;IACxB,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CAC1C;AAED,UAAU,gBAAgB;IACxB,GAAG,EAAE,GAAG,CAAC;CACV;AAOD,wBAAgB,UAAU,IAAG,OAAO,CAEnC;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAE,IAAI,CAShE;AAED,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,gBAAqB,GAAE,IAAI,CAEvE"}
@@ -1,48 +0,0 @@
1
- /**
2
- * @file binding-post.ts
3
- * @author tngan
4
- * @desc Binding-level API, declare the functions using POST binding
5
- */
6
- import type { BindingContext } from './entity.js';
7
- /**
8
- * @desc Generate a base64 encoded login request
9
- * @param {string} referenceTagXPath reference uri
10
- * @param {object} entity object includes both idp and sp
11
- * @param {function} customTagReplacement used when developers have their own login response template
12
- */
13
- declare function base64LoginRequest(referenceTagXPath: string, entity: any, customTagReplacement?: (template: string) => BindingContext): BindingContext;
14
- /**
15
- * @desc Generate a base64 encoded login response
16
- * @param {object} requestInfo corresponding request, used to obtain the id
17
- * @param {object} entity object includes both idp and sp
18
- * @param {object} user current logged user (e.g. req.user)
19
- * @param {function} customTagReplacement used when developers have their own login response template
20
- * @param {boolean} encryptThenSign whether or not to encrypt then sign first (if signing). Defaults to sign-then-encrypt
21
- * @param AttributeStatement
22
- */
23
- declare function base64LoginResponse(requestInfo: any | undefined, entity: any, user?: any, customTagReplacement?: (template: string) => BindingContext, encryptThenSign?: boolean, AttributeStatement?: never[]): Promise<BindingContext>;
24
- /**
25
- * @desc Generate a base64 encoded logout request
26
- * @param {object} user current logged user (e.g. req.user)
27
- * @param {string} referenceTagXPath reference uri
28
- * @param {object} entity object includes both idp and sp
29
- * @param {function} customTagReplacement used when developers have their own login response template
30
- * @return {string} base64 encoded request
31
- */
32
- declare function base64LogoutRequest(user: Record<string, unknown>, referenceTagXPath: string, entity: any, customTagReplacement?: (template: string) => BindingContext): BindingContext;
33
- /**
34
- * @desc Generate a base64 encoded logout response
35
- * @param {object} requestInfo corresponding request, used to obtain the id
36
- * @param {string} referenceTagXPath reference uri
37
- * @param {object} entity object includes both idp and sp
38
- * @param {function} customTagReplacement used when developers have their own login response template
39
- */
40
- declare function base64LogoutResponse(requestInfo: any, entity: any, customTagReplacement: (template: string) => BindingContext): BindingContext;
41
- declare const postBinding: {
42
- base64LoginRequest: typeof base64LoginRequest;
43
- base64LoginResponse: typeof base64LoginResponse;
44
- base64LogoutRequest: typeof base64LogoutRequest;
45
- base64LogoutResponse: typeof base64LogoutResponse;
46
- };
47
- export default postBinding;
48
- //# sourceMappingURL=binding-post.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"binding-post.d.ts","sourceRoot":"","sources":["../src/binding-post.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAGF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAMlD;;;;;EAKE;AACF,iBAAS,kBAAkB,CAAC,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,oBAAoB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,cAAc,GAAG,cAAc,CAqD/I;AACD;;;;;;;;GAQG;AACH,iBAAe,mBAAmB,CAAC,WAAW,EAAE,GAAG,YAAK,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,GAAE,GAAQ,EAAE,oBAAoB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,cAAc,EAAE,eAAe,GAAE,OAAe,EAAG,kBAAkB,UAAG,GAAG,OAAO,CAAC,cAAc,CAAC,CAuIrO;AACD;;;;;;;EAOE;AACF,iBAAS,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,EAAC,MAAM,EAAE,MAAM,KAAA,EAAE,oBAAoB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,cAAc,GAAG,cAAc,CAkDzK;AACD;;;;;;EAME;AACF,iBAAS,oBAAoB,CAAC,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,oBAAoB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,cAAc,GAAG,cAAc,CAsDvI;AAED,QAAA,MAAM,WAAW;;;;;CAKhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,54 +0,0 @@
1
- import type { BindingContext } from './entity.js';
2
- import { IdentityProvider as Idp } from './entity-idp.js';
3
- import { ServiceProvider as Sp } from './entity-sp.js';
4
- export interface BuildRedirectConfig {
5
- baseUrl: string;
6
- type: string;
7
- isSigned: boolean;
8
- context: string;
9
- entitySetting: any;
10
- relayState?: string;
11
- }
12
- /**
13
- * @desc Redirect URL for login request
14
- * @param {object} entity object includes both idp and sp
15
- * @param {function} customTagReplacement used when developers have their own login response template
16
- * @return {string} redirect URL
17
- */
18
- declare function loginRequestRedirectURL(entity: {
19
- idp: Idp;
20
- sp: Sp;
21
- }, customTagReplacement?: (template: string) => BindingContext): BindingContext;
22
- /**
23
- * @desc Redirect URL for login response
24
- * @param {object} requestInfo corresponding request, used to obtain the id
25
- * @param {object} entity object includes both idp and sp
26
- * @param {object} user current logged user (e.g. req.user)
27
- * @param {String} relayState the relaystate sent by sp corresponding request
28
- * @param {function} customTagReplacement used when developers have their own login response template
29
- * @param AttributeStatement
30
- */
31
- declare function loginResponseRedirectURL(requestInfo: any, entity: any, user?: any, relayState?: string, customTagReplacement?: (template: string) => BindingContext, AttributeStatement?: never[]): BindingContext;
32
- /**
33
- * @desc Redirect URL for logout request
34
- * @param {object} user current logged user (e.g. req.user)
35
- * @param {object} entity object includes both idp and sp
36
- * @param {function} customTagReplacement used when developers have their own login response template
37
- * @return {string} redirect URL
38
- */
39
- declare function logoutRequestRedirectURL(user: any, entity: any, relayState?: string, customTagReplacement?: (template: string, tags: object) => BindingContext): BindingContext;
40
- /**
41
- * @desc Redirect URL for logout response
42
- * @param {object} requescorresponding request, used to obtain the id
43
- * @param {object} entity object includes both idp and sp
44
- * @param {function} customTagReplacement used when developers have their own login response template
45
- */
46
- declare function logoutResponseRedirectURL(requestInfo: any, entity: any, relayState?: string, customTagReplacement?: (template: string) => BindingContext): BindingContext;
47
- declare const redirectBinding: {
48
- loginRequestRedirectURL: typeof loginRequestRedirectURL;
49
- loginResponseRedirectURL: typeof loginResponseRedirectURL;
50
- logoutRequestRedirectURL: typeof logoutRequestRedirectURL;
51
- logoutResponseRedirectURL: typeof logoutResponseRedirectURL;
52
- };
53
- export default redirectBinding;
54
- //# sourceMappingURL=binding-redirect.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"binding-redirect.d.ts","sourceRoot":"","sources":["../src/binding-redirect.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAChD,OAAO,EAAC,gBAAgB,IAAI,GAAG,EAAC,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAC,eAAe,IAAI,EAAE,EAAC,MAAM,gBAAgB,CAAC;AAOrD,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,GAAG,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAgED;;;;;GAKG;AACH,iBAAS,uBAAuB,CAAC,MAAM,EAAE;IACvC,GAAG,EAAE,GAAG,CAAC;IACT,EAAE,EAAE,EAAE,CAAA;CACP,EAAE,oBAAoB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,cAAc,GAAG,cAAc,CAyC9E;AAED;;;;;;;;GAQG;AACH,iBAAS,wBAAwB,CAAC,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,GAAE,GAAQ,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,oBAAoB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,cAAc,EAAC,kBAAkB,UAAI,GAAG,cAAc,CAoGxM;AAED;;;;;;GAMG;AACH,iBAAS,wBAAwB,CAAC,IAAI,KAAA,EAAE,MAAM,KAAA,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,oBAAoB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,cAAc,GAAG,cAAc,CAwC9J;AAED;;;;;GAKG;AACH,iBAAS,yBAAyB,CAAC,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,oBAAoB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,cAAc,GAAG,cAAc,CAyClK;AAED,QAAA,MAAM,eAAe;;;;;CAKpB,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,41 +0,0 @@
1
- /**
2
- * @file binding-simplesign.ts
3
- * @author Orange
4
- * @desc Binding-level API, declare the functions using POST SimpleSign binding
5
- */
6
- import type { BindingContext, SimpleSignComputedContext } from './entity.js';
7
- export interface BuildSimpleSignConfig {
8
- type: string;
9
- context: string;
10
- entitySetting: any;
11
- relayState?: string;
12
- }
13
- export interface BindingSimpleSignContext {
14
- id: string;
15
- context: string;
16
- signature: any;
17
- sigAlg: string;
18
- }
19
- /**
20
- * @desc Generate a base64 encoded login request
21
- * @param {string} referenceTagXPath reference uri
22
- * @param {object} entity object includes both idp and sp
23
- * @param {function} customTagReplacement used when developers have their own login response template
24
- */
25
- declare function base64LoginRequest(entity: any, customTagReplacement?: (template: string) => BindingContext): SimpleSignComputedContext;
26
- /**
27
- * @desc Generate a base64 encoded login response
28
- * @param {object} requestInfo corresponding request, used to obtain the id
29
- * @param {object} entity object includes both idp and sp
30
- * @param {object} user current logged user (e.g. req.user)
31
- * @param {string} relayState the relay state
32
- * @param {function} customTagReplacement used when developers have their own login response template
33
- * @param AttributeStatement
34
- */
35
- declare function base64LoginResponse(requestInfo: any | undefined, entity: any, user?: any, relayState?: string, customTagReplacement?: (template: string) => BindingContext, AttributeStatement?: []): Promise<BindingSimpleSignContext>;
36
- declare const simpleSignBinding: {
37
- base64LoginRequest: typeof base64LoginRequest;
38
- base64LoginResponse: typeof base64LoginResponse;
39
- };
40
- export default simpleSignBinding;
41
- //# sourceMappingURL=binding-simplesign.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"binding-simplesign.d.ts","sourceRoot":"","sources":["../src/binding-simplesign.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAGF,OAAQ,KAAK,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAO9E,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,GAAG,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,GAAG,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AA6CD;;;;;EAKE;AACF,iBAAS,kBAAkB,CAAC,MAAM,EAAE,GAAG,EAAE,oBAAoB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,cAAc,GAAG,yBAAyB,CAkD/H;AACD;;;;;;;;GAQG;AACH,iBAAe,mBAAmB,CAAC,WAAW,EAAE,GAAG,YAAK,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,GAAE,GAAQ,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,oBAAoB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,cAAc,EAAE,kBAAkB,GAAC,EAAO,GAAG,OAAO,CAAC,wBAAwB,CAAC,CA6FtO;AAED,QAAA,MAAM,iBAAiB;;;CAGpB,CAAC;AAEJ,eAAe,iBAAiB,CAAC"}